// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by sidekick. DO NOT EDIT.

#![allow(rustdoc::redundant_explicit_links)]
#![allow(rustdoc::broken_intra_doc_links)]
#![no_implicit_prelude]
extern crate async_trait;
extern crate bytes;
extern crate gax;
extern crate gaxi;
extern crate iam_v1;
extern crate lazy_static;
extern crate longrunning;
extern crate lro;
extern crate reqwest;
extern crate serde;
extern crate serde_json;
extern crate serde_with;
extern crate std;
extern crate tracing;
extern crate wkt;

mod debug;
mod deserialize;
mod serialize;

/// A data exchange is a container that lets you share data. Along with the
/// descriptive information about the data exchange, it contains listings that
/// reference shared datasets.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DataExchange {
    /// Output only. The resource name of the data exchange.
    /// e.g. `projects/myproject/locations/us/dataExchanges/123`.
    pub name: std::string::String,

    /// Required. Human-readable display name of the data exchange. The display
    /// name must contain only Unicode letters, numbers (0-9), underscores (_),
    /// dashes (-), spaces ( ), ampersands (&) and must not start or end with
    /// spaces. Default value is an empty string. Max length: 63 bytes.
    pub display_name: std::string::String,

    /// Optional. Description of the data exchange. The description must not
    /// contain Unicode non-characters as well as C0 and C1 control codes except
    /// tabs (HT), new lines (LF), carriage returns (CR), and page breaks (FF).
    /// Default value is an empty string.
    /// Max length: 2000 bytes.
    pub description: std::string::String,

    /// Optional. Email or URL of the primary point of contact of the data
    /// exchange. Max Length: 1000 bytes.
    pub primary_contact: std::string::String,

    /// Optional. Documentation describing the data exchange.
    pub documentation: std::string::String,

    /// Output only. Number of listings contained in the data exchange.
    pub listing_count: i32,

    /// Optional. Base64 encoded image representing the data exchange. Max
    /// Size: 3.0MiB Expected image dimensions are 512x512 pixels, however the API
    /// only performs validation on size of the encoded data. Note: For byte
    /// fields, the content of the fields are base64-encoded (which increases the
    /// size of the data by 33-36%) when using JSON on the wire.
    pub icon: ::bytes::Bytes,

    /// Optional. Configurable data sharing environment option for a data exchange.
    pub sharing_environment_config: std::option::Option<crate::model::SharingEnvironmentConfig>,

    /// Optional. Type of discovery on the discovery page for all the listings
    /// under this exchange. Updating this field also updates (overwrites) the
    /// discovery_type field for all the listings under this exchange.
    pub discovery_type: std::option::Option<crate::model::DiscoveryType>,

    /// Optional. By default, false.
    /// If true, the DataExchange has an email sharing mandate enabled.
    pub log_linked_dataset_query_user_email: std::option::Option<bool>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DataExchange {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::DataExchange::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [display_name][crate::model::DataExchange::display_name].
    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.display_name = v.into();
        self
    }

    /// Sets the value of [description][crate::model::DataExchange::description].
    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.description = v.into();
        self
    }

    /// Sets the value of [primary_contact][crate::model::DataExchange::primary_contact].
    pub fn set_primary_contact<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.primary_contact = v.into();
        self
    }

    /// Sets the value of [documentation][crate::model::DataExchange::documentation].
    pub fn set_documentation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.documentation = v.into();
        self
    }

    /// Sets the value of [listing_count][crate::model::DataExchange::listing_count].
    pub fn set_listing_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.listing_count = v.into();
        self
    }

    /// Sets the value of [icon][crate::model::DataExchange::icon].
    pub fn set_icon<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
        self.icon = v.into();
        self
    }

    /// Sets the value of [sharing_environment_config][crate::model::DataExchange::sharing_environment_config].
    pub fn set_sharing_environment_config<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::SharingEnvironmentConfig>,
    {
        self.sharing_environment_config = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [sharing_environment_config][crate::model::DataExchange::sharing_environment_config].
    pub fn set_or_clear_sharing_environment_config<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::SharingEnvironmentConfig>,
    {
        self.sharing_environment_config = v.map(|x| x.into());
        self
    }

    /// Sets the value of [discovery_type][crate::model::DataExchange::discovery_type].
    pub fn set_discovery_type<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::DiscoveryType>,
    {
        self.discovery_type = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [discovery_type][crate::model::DataExchange::discovery_type].
    pub fn set_or_clear_discovery_type<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::DiscoveryType>,
    {
        self.discovery_type = v.map(|x| x.into());
        self
    }

    /// Sets the value of [log_linked_dataset_query_user_email][crate::model::DataExchange::log_linked_dataset_query_user_email].
    pub fn set_log_linked_dataset_query_user_email<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<bool>,
    {
        self.log_linked_dataset_query_user_email = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [log_linked_dataset_query_user_email][crate::model::DataExchange::log_linked_dataset_query_user_email].
    pub fn set_or_clear_log_linked_dataset_query_user_email<T>(
        mut self,
        v: std::option::Option<T>,
    ) -> Self
    where
        T: std::convert::Into<bool>,
    {
        self.log_linked_dataset_query_user_email = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for DataExchange {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.bigquery.analyticshub.v1.DataExchange"
    }
}

/// A query template is a container for sharing table-valued functions defined by
/// contributors in a data clean room.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct QueryTemplate {
    /// Output only. The resource name of the QueryTemplate.
    /// e.g. `projects/myproject/locations/us/dataExchanges/123/queryTemplates/456`
    pub name: std::string::String,

    /// Required. Human-readable display name of the QueryTemplate. The display
    /// name must contain only Unicode letters, numbers (0-9), underscores (_),
    /// dashes (-), spaces ( ), ampersands (&) and can't start or end with spaces.
    /// Default value is an empty string. Max length: 63 bytes.
    pub display_name: std::string::String,

    /// Optional. Short description of the QueryTemplate. The description must not
    /// contain Unicode non-characters and C0 and C1 control codes except tabs
    /// (HT), new lines (LF), carriage returns (CR), and page breaks (FF). Default
    /// value is an empty string. Max length: 2000 bytes.
    pub description: std::string::String,

    /// Optional. Will be deprecated.
    /// Email or URL of the primary point of contact of the QueryTemplate.
    /// Max Length: 1000 bytes.
    pub proposer: std::string::String,

    /// Optional. Email or URL of the primary point of contact of the
    /// QueryTemplate. Max Length: 1000 bytes.
    pub primary_contact: std::string::String,

    /// Optional. Documentation describing the QueryTemplate.
    pub documentation: std::string::String,

    /// Output only. The QueryTemplate lifecycle state.
    pub state: crate::model::query_template::State,

    /// Optional. The routine associated with the QueryTemplate.
    pub routine: std::option::Option<crate::model::Routine>,

    /// Output only. Timestamp when the QueryTemplate was created.
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// Output only. Timestamp when the QueryTemplate was last modified.
    pub update_time: std::option::Option<wkt::Timestamp>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl QueryTemplate {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::QueryTemplate::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [display_name][crate::model::QueryTemplate::display_name].
    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.display_name = v.into();
        self
    }

    /// Sets the value of [description][crate::model::QueryTemplate::description].
    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.description = v.into();
        self
    }

    /// Sets the value of [proposer][crate::model::QueryTemplate::proposer].
    pub fn set_proposer<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.proposer = v.into();
        self
    }

    /// Sets the value of [primary_contact][crate::model::QueryTemplate::primary_contact].
    pub fn set_primary_contact<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.primary_contact = v.into();
        self
    }

    /// Sets the value of [documentation][crate::model::QueryTemplate::documentation].
    pub fn set_documentation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.documentation = v.into();
        self
    }

    /// Sets the value of [state][crate::model::QueryTemplate::state].
    pub fn set_state<T: std::convert::Into<crate::model::query_template::State>>(
        mut self,
        v: T,
    ) -> Self {
        self.state = v.into();
        self
    }

    /// Sets the value of [routine][crate::model::QueryTemplate::routine].
    pub fn set_routine<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::Routine>,
    {
        self.routine = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [routine][crate::model::QueryTemplate::routine].
    pub fn set_or_clear_routine<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::Routine>,
    {
        self.routine = v.map(|x| x.into());
        self
    }

    /// Sets the value of [create_time][crate::model::QueryTemplate::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::QueryTemplate::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_time][crate::model::QueryTemplate::update_time].
    pub fn set_update_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_time][crate::model::QueryTemplate::update_time].
    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for QueryTemplate {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.bigquery.analyticshub.v1.QueryTemplate"
    }
}

/// Defines additional types related to [QueryTemplate].
pub mod query_template {
    #[allow(unused_imports)]
    use super::*;

    /// The QueryTemplate lifecycle state.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum State {
        /// Default value. This value is unused.
        Unspecified,
        /// The QueryTemplate is in draft state.
        Drafted,
        /// The QueryTemplate is in pending state.
        Pending,
        /// The QueryTemplate is in deleted state.
        Deleted,
        /// The QueryTemplate is in approved state.
        Approved,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [State::value] or
        /// [State::name].
        UnknownValue(state::UnknownValue),
    }

    #[doc(hidden)]
    pub mod state {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl State {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::Drafted => std::option::Option::Some(1),
                Self::Pending => std::option::Option::Some(2),
                Self::Deleted => std::option::Option::Some(3),
                Self::Approved => std::option::Option::Some(4),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
                Self::Drafted => std::option::Option::Some("DRAFTED"),
                Self::Pending => std::option::Option::Some("PENDING"),
                Self::Deleted => std::option::Option::Some("DELETED"),
                Self::Approved => std::option::Option::Some("APPROVED"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for State {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for State {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for State {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::Drafted,
                2 => Self::Pending,
                3 => Self::Deleted,
                4 => Self::Approved,
                _ => Self::UnknownValue(state::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for State {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "STATE_UNSPECIFIED" => Self::Unspecified,
                "DRAFTED" => Self::Drafted,
                "PENDING" => Self::Pending,
                "DELETED" => Self::Deleted,
                "APPROVED" => Self::Approved,
                _ => Self::UnknownValue(state::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for State {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::Drafted => serializer.serialize_i32(1),
                Self::Pending => serializer.serialize_i32(2),
                Self::Deleted => serializer.serialize_i32(3),
                Self::Approved => serializer.serialize_i32(4),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for State {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
                ".google.cloud.bigquery.analyticshub.v1.QueryTemplate.State",
            ))
        }
    }
}

/// Represents a bigquery routine.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Routine {
    /// Required. The type of routine.
    pub routine_type: crate::model::routine::RoutineType,

    /// Optional. The definition body of the routine.
    pub definition_body: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl Routine {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [routine_type][crate::model::Routine::routine_type].
    pub fn set_routine_type<T: std::convert::Into<crate::model::routine::RoutineType>>(
        mut self,
        v: T,
    ) -> Self {
        self.routine_type = v.into();
        self
    }

    /// Sets the value of [definition_body][crate::model::Routine::definition_body].
    pub fn set_definition_body<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.definition_body = v.into();
        self
    }
}

impl wkt::message::Message for Routine {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.bigquery.analyticshub.v1.Routine"
    }
}

/// Defines additional types related to [Routine].
pub mod routine {
    #[allow(unused_imports)]
    use super::*;

    /// Represents the type of a given routine.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum RoutineType {
        /// Default value.
        Unspecified,
        /// Non-built-in persistent TVF.
        TableValuedFunction,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [RoutineType::value] or
        /// [RoutineType::name].
        UnknownValue(routine_type::UnknownValue),
    }

    #[doc(hidden)]
    pub mod routine_type {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl RoutineType {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::TableValuedFunction => std::option::Option::Some(1),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("ROUTINE_TYPE_UNSPECIFIED"),
                Self::TableValuedFunction => std::option::Option::Some("TABLE_VALUED_FUNCTION"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for RoutineType {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for RoutineType {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for RoutineType {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::TableValuedFunction,
                _ => Self::UnknownValue(routine_type::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for RoutineType {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "ROUTINE_TYPE_UNSPECIFIED" => Self::Unspecified,
                "TABLE_VALUED_FUNCTION" => Self::TableValuedFunction,
                _ => Self::UnknownValue(routine_type::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for RoutineType {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::TableValuedFunction => serializer.serialize_i32(1),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for RoutineType {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<RoutineType>::new(
                ".google.cloud.bigquery.analyticshub.v1.Routine.RoutineType",
            ))
        }
    }
}

/// Message for creating a QueryTemplate.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateQueryTemplateRequest {
    /// Required. The parent resource path of the QueryTemplate.
    /// e.g.
    /// `projects/myproject/locations/us/dataExchanges/123/queryTemplates/myQueryTemplate`.
    pub parent: std::string::String,

    /// Required. The ID of the QueryTemplate to create.
    /// Must contain only Unicode letters, numbers (0-9), underscores (_).
    /// Max length: 100 bytes.
    pub query_template_id: std::string::String,

    /// Required. The QueryTemplate to create.
    pub query_template: std::option::Option<crate::model::QueryTemplate>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CreateQueryTemplateRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::CreateQueryTemplateRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [query_template_id][crate::model::CreateQueryTemplateRequest::query_template_id].
    pub fn set_query_template_id<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.query_template_id = v.into();
        self
    }

    /// Sets the value of [query_template][crate::model::CreateQueryTemplateRequest::query_template].
    pub fn set_query_template<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::QueryTemplate>,
    {
        self.query_template = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [query_template][crate::model::CreateQueryTemplateRequest::query_template].
    pub fn set_or_clear_query_template<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::QueryTemplate>,
    {
        self.query_template = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for CreateQueryTemplateRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.bigquery.analyticshub.v1.CreateQueryTemplateRequest"
    }
}

/// Message for creating a QueryTemplate.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetQueryTemplateRequest {
    /// Required. The parent resource path of the QueryTemplate.
    /// e.g.
    /// `projects/myproject/locations/us/dataExchanges/123/queryTemplates/myqueryTemplate`.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetQueryTemplateRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetQueryTemplateRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetQueryTemplateRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.bigquery.analyticshub.v1.GetQueryTemplateRequest"
    }
}

/// Message for requesting the list of QueryTemplates.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListQueryTemplatesRequest {
    /// Required. The parent resource path of the QueryTemplates.
    /// e.g. `projects/myproject/locations/us/dataExchanges/123`.
    pub parent: std::string::String,

    /// Optional. The maximum number of results to return in a single response
    /// page. Leverage the page tokens to iterate through the entire collection.
    pub page_size: i32,

    /// Optional. Page token, returned by a previous call, to request the next page
    /// of results.
    pub page_token: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListQueryTemplatesRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListQueryTemplatesRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListQueryTemplatesRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListQueryTemplatesRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }
}

impl wkt::message::Message for ListQueryTemplatesRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.bigquery.analyticshub.v1.ListQueryTemplatesRequest"
    }
}

/// Message for response to the list of QueryTemplates.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListQueryTemplatesResponse {
    /// The list of QueryTemplates.
    pub query_templates: std::vec::Vec<crate::model::QueryTemplate>,

    /// A token to request the next page of results.
    pub next_page_token: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListQueryTemplatesResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [query_templates][crate::model::ListQueryTemplatesResponse::query_templates].
    pub fn set_query_templates<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::QueryTemplate>,
    {
        use std::iter::Iterator;
        self.query_templates = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListQueryTemplatesResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }
}

impl wkt::message::Message for ListQueryTemplatesResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.bigquery.analyticshub.v1.ListQueryTemplatesResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListQueryTemplatesResponse {
    type PageItem = crate::model::QueryTemplate;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.query_templates
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// Message for updating a QueryTemplate.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateQueryTemplateRequest {
    /// Optional. Field mask specifies the fields to update in the query template
    /// resource. The fields specified in the `updateMask` are relative to the
    /// resource and are not a full request.
    pub update_mask: std::option::Option<wkt::FieldMask>,

    /// Required. The QueryTemplate to update.
    pub query_template: std::option::Option<crate::model::QueryTemplate>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl UpdateQueryTemplateRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [update_mask][crate::model::UpdateQueryTemplateRequest::update_mask].
    pub fn set_update_mask<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_mask][crate::model::UpdateQueryTemplateRequest::update_mask].
    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = v.map(|x| x.into());
        self
    }

    /// Sets the value of [query_template][crate::model::UpdateQueryTemplateRequest::query_template].
    pub fn set_query_template<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::QueryTemplate>,
    {
        self.query_template = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [query_template][crate::model::UpdateQueryTemplateRequest::query_template].
    pub fn set_or_clear_query_template<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::QueryTemplate>,
    {
        self.query_template = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for UpdateQueryTemplateRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.bigquery.analyticshub.v1.UpdateQueryTemplateRequest"
    }
}

/// Message for deleting a QueryTemplate.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteQueryTemplateRequest {
    /// Required. The resource path of the QueryTemplate.
    /// e.g.
    /// `projects/myproject/locations/us/dataExchanges/123/queryTemplates/myqueryTemplate`.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DeleteQueryTemplateRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::DeleteQueryTemplateRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for DeleteQueryTemplateRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.bigquery.analyticshub.v1.DeleteQueryTemplateRequest"
    }
}

/// Message for submitting a QueryTemplate.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SubmitQueryTemplateRequest {
    /// Required. The resource path of the QueryTemplate.
    /// e.g.
    /// `projects/myproject/locations/us/dataExchanges/123/queryTemplates/myqueryTemplate`.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl SubmitQueryTemplateRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::SubmitQueryTemplateRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for SubmitQueryTemplateRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.bigquery.analyticshub.v1.SubmitQueryTemplateRequest"
    }
}

/// Message for approving a QueryTemplate.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ApproveQueryTemplateRequest {
    /// Required. The resource path of the QueryTemplate.
    /// e.g.
    /// `projects/myproject/locations/us/dataExchanges/123/queryTemplates/myqueryTemplate`.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ApproveQueryTemplateRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::ApproveQueryTemplateRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for ApproveQueryTemplateRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.bigquery.analyticshub.v1.ApproveQueryTemplateRequest"
    }
}

/// Sharing environment is a behavior model for sharing data within a
/// data exchange. This option is configurable for a data exchange.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SharingEnvironmentConfig {
    pub environment: std::option::Option<crate::model::sharing_environment_config::Environment>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl SharingEnvironmentConfig {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [environment][crate::model::SharingEnvironmentConfig::environment].
    ///
    /// Note that all the setters affecting `environment` are mutually
    /// exclusive.
    pub fn set_environment<
        T: std::convert::Into<
                std::option::Option<crate::model::sharing_environment_config::Environment>,
            >,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.environment = v.into();
        self
    }

    /// The value of [environment][crate::model::SharingEnvironmentConfig::environment]
    /// if it holds a `DefaultExchangeConfig`, `None` if the field is not set or
    /// holds a different branch.
    pub fn default_exchange_config(
        &self,
    ) -> std::option::Option<
        &std::boxed::Box<crate::model::sharing_environment_config::DefaultExchangeConfig>,
    > {
        #[allow(unreachable_patterns)]
        self.environment.as_ref().and_then(|v| match v {
            crate::model::sharing_environment_config::Environment::DefaultExchangeConfig(v) => {
                std::option::Option::Some(v)
            }
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [environment][crate::model::SharingEnvironmentConfig::environment]
    /// to hold a `DefaultExchangeConfig`.
    ///
    /// Note that all the setters affecting `environment` are
    /// mutually exclusive.
    pub fn set_default_exchange_config<
        T: std::convert::Into<
                std::boxed::Box<crate::model::sharing_environment_config::DefaultExchangeConfig>,
            >,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.environment = std::option::Option::Some(
            crate::model::sharing_environment_config::Environment::DefaultExchangeConfig(v.into()),
        );
        self
    }

    /// The value of [environment][crate::model::SharingEnvironmentConfig::environment]
    /// if it holds a `DcrExchangeConfig`, `None` if the field is not set or
    /// holds a different branch.
    pub fn dcr_exchange_config(
        &self,
    ) -> std::option::Option<
        &std::boxed::Box<crate::model::sharing_environment_config::DcrExchangeConfig>,
    > {
        #[allow(unreachable_patterns)]
        self.environment.as_ref().and_then(|v| match v {
            crate::model::sharing_environment_config::Environment::DcrExchangeConfig(v) => {
                std::option::Option::Some(v)
            }
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [environment][crate::model::SharingEnvironmentConfig::environment]
    /// to hold a `DcrExchangeConfig`.
    ///
    /// Note that all the setters affecting `environment` are
    /// mutually exclusive.
    pub fn set_dcr_exchange_config<
        T: std::convert::Into<
                std::boxed::Box<crate::model::sharing_environment_config::DcrExchangeConfig>,
            >,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.environment = std::option::Option::Some(
            crate::model::sharing_environment_config::Environment::DcrExchangeConfig(v.into()),
        );
        self
    }
}

impl wkt::message::Message for SharingEnvironmentConfig {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.bigquery.analyticshub.v1.SharingEnvironmentConfig"
    }
}

/// Defines additional types related to [SharingEnvironmentConfig].
pub mod sharing_environment_config {
    #[allow(unused_imports)]
    use super::*;

    /// Default Analytics Hub data exchange, used for secured data sharing.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct DefaultExchangeConfig {
        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl DefaultExchangeConfig {
        pub fn new() -> Self {
            std::default::Default::default()
        }
    }

    impl wkt::message::Message for DefaultExchangeConfig {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.bigquery.analyticshub.v1.SharingEnvironmentConfig.DefaultExchangeConfig"
        }
    }

    /// Data Clean Room (DCR), used for privacy-safe and secured data sharing.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct DcrExchangeConfig {
        /// Output only. If True, this DCR restricts the contributors to sharing
        /// only a single resource in a Listing. And no two resources should have the
        /// same IDs. So if a contributor adds a view with a conflicting name, the
        /// CreateListing API will reject the request. if False, the data contributor
        /// can publish an entire dataset (as before). This is not configurable, and
        /// by default, all new DCRs will have the restriction set to True.
        pub single_selected_resource_sharing_restriction: std::option::Option<bool>,

        /// Output only. If True, when subscribing to this DCR, it will create only
        /// one linked dataset containing all resources shared within the
        /// cleanroom. If False, when subscribing to this DCR, it will
        /// create 1 linked dataset per listing. This is not configurable, and by
        /// default, all new DCRs will have the restriction set to True.
        pub single_linked_dataset_per_cleanroom: std::option::Option<bool>,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl DcrExchangeConfig {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [single_selected_resource_sharing_restriction][crate::model::sharing_environment_config::DcrExchangeConfig::single_selected_resource_sharing_restriction].
        pub fn set_single_selected_resource_sharing_restriction<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<bool>,
        {
            self.single_selected_resource_sharing_restriction = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [single_selected_resource_sharing_restriction][crate::model::sharing_environment_config::DcrExchangeConfig::single_selected_resource_sharing_restriction].
        pub fn set_or_clear_single_selected_resource_sharing_restriction<T>(
            mut self,
            v: std::option::Option<T>,
        ) -> Self
        where
            T: std::convert::Into<bool>,
        {
            self.single_selected_resource_sharing_restriction = v.map(|x| x.into());
            self
        }

        /// Sets the value of [single_linked_dataset_per_cleanroom][crate::model::sharing_environment_config::DcrExchangeConfig::single_linked_dataset_per_cleanroom].
        pub fn set_single_linked_dataset_per_cleanroom<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<bool>,
        {
            self.single_linked_dataset_per_cleanroom = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [single_linked_dataset_per_cleanroom][crate::model::sharing_environment_config::DcrExchangeConfig::single_linked_dataset_per_cleanroom].
        pub fn set_or_clear_single_linked_dataset_per_cleanroom<T>(
            mut self,
            v: std::option::Option<T>,
        ) -> Self
        where
            T: std::convert::Into<bool>,
        {
            self.single_linked_dataset_per_cleanroom = v.map(|x| x.into());
            self
        }
    }

    impl wkt::message::Message for DcrExchangeConfig {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.bigquery.analyticshub.v1.SharingEnvironmentConfig.DcrExchangeConfig"
        }
    }

    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum Environment {
        /// Default Analytics Hub data exchange, used for secured data sharing.
        DefaultExchangeConfig(
            std::boxed::Box<crate::model::sharing_environment_config::DefaultExchangeConfig>,
        ),
        /// Data Clean Room (DCR), used for privacy-safe and secured data sharing.
        DcrExchangeConfig(
            std::boxed::Box<crate::model::sharing_environment_config::DcrExchangeConfig>,
        ),
    }
}

/// Contains details of the data provider.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DataProvider {
    /// Optional. Name of the data provider.
    pub name: std::string::String,

    /// Optional. Email or URL of the data provider.
    /// Max Length: 1000 bytes.
    pub primary_contact: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DataProvider {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::DataProvider::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [primary_contact][crate::model::DataProvider::primary_contact].
    pub fn set_primary_contact<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.primary_contact = v.into();
        self
    }
}

impl wkt::message::Message for DataProvider {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.bigquery.analyticshub.v1.DataProvider"
    }
}

/// Contains details of the listing publisher.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Publisher {
    /// Optional. Name of the listing publisher.
    pub name: std::string::String,

    /// Optional. Email or URL of the listing publisher.
    /// Max Length: 1000 bytes.
    pub primary_contact: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl Publisher {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::Publisher::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [primary_contact][crate::model::Publisher::primary_contact].
    pub fn set_primary_contact<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.primary_contact = v.into();
        self
    }
}

impl wkt::message::Message for Publisher {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.bigquery.analyticshub.v1.Publisher"
    }
}

#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DestinationDatasetReference {
    /// Required. A unique ID for this dataset, without the project name. The ID
    /// must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_).
    /// The maximum length is 1,024 characters.
    pub dataset_id: std::string::String,

    /// Required. The ID of the project containing this dataset.
    pub project_id: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DestinationDatasetReference {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [dataset_id][crate::model::DestinationDatasetReference::dataset_id].
    pub fn set_dataset_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.dataset_id = v.into();
        self
    }

    /// Sets the value of [project_id][crate::model::DestinationDatasetReference::project_id].
    pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.project_id = v.into();
        self
    }
}

impl wkt::message::Message for DestinationDatasetReference {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.bigquery.analyticshub.v1.DestinationDatasetReference"
    }
}

/// Defines the destination bigquery dataset.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DestinationDataset {
    /// Required. A reference that identifies the destination dataset.
    pub dataset_reference: std::option::Option<crate::model::DestinationDatasetReference>,

    /// Optional. A descriptive name for the dataset.
    pub friendly_name: std::option::Option<wkt::StringValue>,

    /// Optional. A user-friendly description of the dataset.
    pub description: std::option::Option<wkt::StringValue>,

    /// Optional. The labels associated with this dataset. You can use these
    /// to organize and group your datasets.
    /// You can set this property when inserting or updating a dataset.
    /// See <https://cloud.google.com/resource-manager/docs/creating-managing-labels>
    /// for more information.
    pub labels: std::collections::HashMap<std::string::String, std::string::String>,

    /// Required. The geographic location where the dataset should reside. See
    /// <https://cloud.google.com/bigquery/docs/locations> for supported
    /// locations.
    pub location: std::string::String,

    /// Optional. The geographic locations where the dataset should be replicated.
    /// See [BigQuery locations](https://cloud.google.com/bigquery/docs/locations)
    /// for supported locations.
    pub replica_locations: std::vec::Vec<std::string::String>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DestinationDataset {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [dataset_reference][crate::model::DestinationDataset::dataset_reference].
    pub fn set_dataset_reference<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::DestinationDatasetReference>,
    {
        self.dataset_reference = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [dataset_reference][crate::model::DestinationDataset::dataset_reference].
    pub fn set_or_clear_dataset_reference<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::DestinationDatasetReference>,
    {
        self.dataset_reference = v.map(|x| x.into());
        self
    }

    /// Sets the value of [friendly_name][crate::model::DestinationDataset::friendly_name].
    pub fn set_friendly_name<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::StringValue>,
    {
        self.friendly_name = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [friendly_name][crate::model::DestinationDataset::friendly_name].
    pub fn set_or_clear_friendly_name<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::StringValue>,
    {
        self.friendly_name = v.map(|x| x.into());
        self
    }

    /// Sets the value of [description][crate::model::DestinationDataset::description].
    pub fn set_description<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::StringValue>,
    {
        self.description = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [description][crate::model::DestinationDataset::description].
    pub fn set_or_clear_description<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::StringValue>,
    {
        self.description = v.map(|x| x.into());
        self
    }

    /// Sets the value of [labels][crate::model::DestinationDataset::labels].
    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }

    /// Sets the value of [location][crate::model::DestinationDataset::location].
    pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.location = v.into();
        self
    }

    /// Sets the value of [replica_locations][crate::model::DestinationDataset::replica_locations].
    pub fn set_replica_locations<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.replica_locations = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for DestinationDataset {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.bigquery.analyticshub.v1.DestinationDataset"
    }
}

/// Defines the destination Pub/Sub subscription.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DestinationPubSubSubscription {
    /// Required. Destination Pub/Sub subscription resource.
    pub pubsub_subscription: std::option::Option<crate::model::PubSubSubscription>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DestinationPubSubSubscription {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [pubsub_subscription][crate::model::DestinationPubSubSubscription::pubsub_subscription].
    pub fn set_pubsub_subscription<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::PubSubSubscription>,
    {
        self.pubsub_subscription = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [pubsub_subscription][crate::model::DestinationPubSubSubscription::pubsub_subscription].
    pub fn set_or_clear_pubsub_subscription<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::PubSubSubscription>,
    {
        self.pubsub_subscription = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for DestinationPubSubSubscription {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.bigquery.analyticshub.v1.DestinationPubSubSubscription"
    }
}

/// A listing is what gets published into a data exchange that a subscriber can
/// subscribe to. It contains a reference to the data source along with
/// descriptive information that will help subscribers find and subscribe the
/// data.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Listing {
    /// Output only. The resource name of the listing.
    /// e.g. `projects/myproject/locations/us/dataExchanges/123/listings/456`
    pub name: std::string::String,

    /// Required. Human-readable display name of the listing. The display name must
    /// contain only Unicode letters, numbers (0-9), underscores (_), dashes (-),
    /// spaces ( ), ampersands (&) and can't start or end with spaces. Default
    /// value is an empty string. Max length: 63 bytes.
    pub display_name: std::string::String,

    /// Optional. Short description of the listing. The description must not
    /// contain Unicode non-characters and C0 and C1 control codes except tabs
    /// (HT), new lines (LF), carriage returns (CR), and page breaks (FF). Default
    /// value is an empty string. Max length: 2000 bytes.
    pub description: std::string::String,

    /// Optional. Email or URL of the primary point of contact of the listing.
    /// Max Length: 1000 bytes.
    pub primary_contact: std::string::String,

    /// Optional. Documentation describing the listing.
    pub documentation: std::string::String,

    /// Output only. Current state of the listing.
    pub state: crate::model::listing::State,

    /// Optional. Base64 encoded image representing the listing. Max Size: 3.0MiB
    /// Expected image dimensions are 512x512 pixels, however the API only
    /// performs validation on size of the encoded data.
    /// Note: For byte fields, the contents of the field are base64-encoded (which
    /// increases the size of the data by 33-36%) when using JSON on the wire.
    pub icon: ::bytes::Bytes,

    /// Optional. Details of the data provider who owns the source data.
    pub data_provider: std::option::Option<crate::model::DataProvider>,

    /// Optional. Categories of the listing. Up to five categories are allowed.
    pub categories: std::vec::Vec<crate::model::listing::Category>,

    /// Optional. Details of the publisher who owns the listing and who can share
    /// the source data.
    pub publisher: std::option::Option<crate::model::Publisher>,

    /// Optional. Email or URL of the request access of the listing.
    /// Subscribers can use this reference to request access.
    /// Max Length: 1000 bytes.
    pub request_access: std::string::String,

    /// Optional. If set, restricted export configuration will be propagated and
    /// enforced on the linked dataset.
    pub restricted_export_config:
        std::option::Option<crate::model::listing::RestrictedExportConfig>,

    /// Optional. If set, stored procedure configuration will be propagated and
    /// enforced on the linked dataset.
    pub stored_procedure_config: std::option::Option<crate::model::StoredProcedureConfig>,

    /// Optional. Type of discovery of the listing on the discovery page.
    pub discovery_type: std::option::Option<crate::model::DiscoveryType>,

    /// Output only. Listing shared asset type.
    pub resource_type: crate::model::SharedResourceType,

    /// Output only. Commercial info contains the information about the commercial
    /// data products associated with the listing.
    pub commercial_info: std::option::Option<crate::model::listing::CommercialInfo>,

    /// Optional. By default, false.
    /// If true, the Listing has an email sharing mandate enabled.
    pub log_linked_dataset_query_user_email: std::option::Option<bool>,

    /// Optional. If true, the listing is only available to get the resource
    /// metadata. Listing is non subscribable.
    pub allow_only_metadata_sharing: std::option::Option<bool>,

    /// Listing source.
    pub source: std::option::Option<crate::model::listing::Source>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl Listing {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::Listing::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [display_name][crate::model::Listing::display_name].
    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.display_name = v.into();
        self
    }

    /// Sets the value of [description][crate::model::Listing::description].
    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.description = v.into();
        self
    }

    /// Sets the value of [primary_contact][crate::model::Listing::primary_contact].
    pub fn set_primary_contact<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.primary_contact = v.into();
        self
    }

    /// Sets the value of [documentation][crate::model::Listing::documentation].
    pub fn set_documentation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.documentation = v.into();
        self
    }

    /// Sets the value of [state][crate::model::Listing::state].
    pub fn set_state<T: std::convert::Into<crate::model::listing::State>>(mut self, v: T) -> Self {
        self.state = v.into();
        self
    }

    /// Sets the value of [icon][crate::model::Listing::icon].
    pub fn set_icon<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
        self.icon = v.into();
        self
    }

    /// Sets the value of [data_provider][crate::model::Listing::data_provider].
    pub fn set_data_provider<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::DataProvider>,
    {
        self.data_provider = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [data_provider][crate::model::Listing::data_provider].
    pub fn set_or_clear_data_provider<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::DataProvider>,
    {
        self.data_provider = v.map(|x| x.into());
        self
    }

    /// Sets the value of [categories][crate::model::Listing::categories].
    pub fn set_categories<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::listing::Category>,
    {
        use std::iter::Iterator;
        self.categories = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [publisher][crate::model::Listing::publisher].
    pub fn set_publisher<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::Publisher>,
    {
        self.publisher = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [publisher][crate::model::Listing::publisher].
    pub fn set_or_clear_publisher<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::Publisher>,
    {
        self.publisher = v.map(|x| x.into());
        self
    }

    /// Sets the value of [request_access][crate::model::Listing::request_access].
    pub fn set_request_access<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.request_access = v.into();
        self
    }

    /// Sets the value of [restricted_export_config][crate::model::Listing::restricted_export_config].
    pub fn set_restricted_export_config<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::listing::RestrictedExportConfig>,
    {
        self.restricted_export_config = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [restricted_export_config][crate::model::Listing::restricted_export_config].
    pub fn set_or_clear_restricted_export_config<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::listing::RestrictedExportConfig>,
    {
        self.restricted_export_config = v.map(|x| x.into());
        self
    }

    /// Sets the value of [stored_procedure_config][crate::model::Listing::stored_procedure_config].
    pub fn set_stored_procedure_config<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::StoredProcedureConfig>,
    {
        self.stored_procedure_config = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [stored_procedure_config][crate::model::Listing::stored_procedure_config].
    pub fn set_or_clear_stored_procedure_config<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::StoredProcedureConfig>,
    {
        self.stored_procedure_config = v.map(|x| x.into());
        self
    }

    /// Sets the value of [discovery_type][crate::model::Listing::discovery_type].
    pub fn set_discovery_type<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::DiscoveryType>,
    {
        self.discovery_type = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [discovery_type][crate::model::Listing::discovery_type].
    pub fn set_or_clear_discovery_type<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::DiscoveryType>,
    {
        self.discovery_type = v.map(|x| x.into());
        self
    }

    /// Sets the value of [resource_type][crate::model::Listing::resource_type].
    pub fn set_resource_type<T: std::convert::Into<crate::model::SharedResourceType>>(
        mut self,
        v: T,
    ) -> Self {
        self.resource_type = v.into();
        self
    }

    /// Sets the value of [commercial_info][crate::model::Listing::commercial_info].
    pub fn set_commercial_info<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::listing::CommercialInfo>,
    {
        self.commercial_info = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [commercial_info][crate::model::Listing::commercial_info].
    pub fn set_or_clear_commercial_info<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::listing::CommercialInfo>,
    {
        self.commercial_info = v.map(|x| x.into());
        self
    }

    /// Sets the value of [log_linked_dataset_query_user_email][crate::model::Listing::log_linked_dataset_query_user_email].
    pub fn set_log_linked_dataset_query_user_email<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<bool>,
    {
        self.log_linked_dataset_query_user_email = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [log_linked_dataset_query_user_email][crate::model::Listing::log_linked_dataset_query_user_email].
    pub fn set_or_clear_log_linked_dataset_query_user_email<T>(
        mut self,
        v: std::option::Option<T>,
    ) -> Self
    where
        T: std::convert::Into<bool>,
    {
        self.log_linked_dataset_query_user_email = v.map(|x| x.into());
        self
    }

    /// Sets the value of [allow_only_metadata_sharing][crate::model::Listing::allow_only_metadata_sharing].
    pub fn set_allow_only_metadata_sharing<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<bool>,
    {
        self.allow_only_metadata_sharing = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [allow_only_metadata_sharing][crate::model::Listing::allow_only_metadata_sharing].
    pub fn set_or_clear_allow_only_metadata_sharing<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<bool>,
    {
        self.allow_only_metadata_sharing = v.map(|x| x.into());
        self
    }

    /// Sets the value of [source][crate::model::Listing::source].
    ///
    /// Note that all the setters affecting `source` are mutually
    /// exclusive.
    pub fn set_source<T: std::convert::Into<std::option::Option<crate::model::listing::Source>>>(
        mut self,
        v: T,
    ) -> Self {
        self.source = v.into();
        self
    }

    /// The value of [source][crate::model::Listing::source]
    /// if it holds a `BigqueryDataset`, `None` if the field is not set or
    /// holds a different branch.
    pub fn bigquery_dataset(
        &self,
    ) -> std::option::Option<&std::boxed::Box<crate::model::listing::BigQueryDatasetSource>> {
        #[allow(unreachable_patterns)]
        self.source.as_ref().and_then(|v| match v {
            crate::model::listing::Source::BigqueryDataset(v) => std::option::Option::Some(v),
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [source][crate::model::Listing::source]
    /// to hold a `BigqueryDataset`.
    ///
    /// Note that all the setters affecting `source` are
    /// mutually exclusive.
    pub fn set_bigquery_dataset<
        T: std::convert::Into<std::boxed::Box<crate::model::listing::BigQueryDatasetSource>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.source =
            std::option::Option::Some(crate::model::listing::Source::BigqueryDataset(v.into()));
        self
    }

    /// The value of [source][crate::model::Listing::source]
    /// if it holds a `PubsubTopic`, `None` if the field is not set or
    /// holds a different branch.
    pub fn pubsub_topic(
        &self,
    ) -> std::option::Option<&std::boxed::Box<crate::model::listing::PubSubTopicSource>> {
        #[allow(unreachable_patterns)]
        self.source.as_ref().and_then(|v| match v {
            crate::model::listing::Source::PubsubTopic(v) => std::option::Option::Some(v),
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [source][crate::model::Listing::source]
    /// to hold a `PubsubTopic`.
    ///
    /// Note that all the setters affecting `source` are
    /// mutually exclusive.
    pub fn set_pubsub_topic<
        T: std::convert::Into<std::boxed::Box<crate::model::listing::PubSubTopicSource>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.source =
            std::option::Option::Some(crate::model::listing::Source::PubsubTopic(v.into()));
        self
    }
}

impl wkt::message::Message for Listing {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.bigquery.analyticshub.v1.Listing"
    }
}

/// Defines additional types related to [Listing].
pub mod listing {
    #[allow(unused_imports)]
    use super::*;

    /// A reference to a shared dataset. It is an existing BigQuery dataset with a
    /// collection of objects such as tables and views that you want to share
    /// with subscribers.
    /// When subscriber's subscribe to a listing, Analytics Hub creates a linked
    /// dataset in
    /// the subscriber's project. A Linked dataset is an opaque, read-only BigQuery
    /// dataset that serves as a _symbolic link_ to a shared dataset.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct BigQueryDatasetSource {
        /// Optional. Resource name of the dataset source for this listing.
        /// e.g. `projects/myproject/datasets/123`
        pub dataset: std::string::String,

        /// Optional. Resource in this dataset that is selectively shared.
        /// This field is required for data clean room exchanges.
        pub selected_resources:
            std::vec::Vec<crate::model::listing::big_query_dataset_source::SelectedResource>,

        /// Optional. If set, restricted export policy will be propagated and
        /// enforced on the linked dataset.
        pub restricted_export_policy: std::option::Option<
            crate::model::listing::big_query_dataset_source::RestrictedExportPolicy,
        >,

        /// Optional. A list of regions where the publisher has created shared
        /// dataset replicas.
        pub replica_locations: std::vec::Vec<std::string::String>,

        /// Output only. Server-owned effective state of replicas.
        /// Contains both primary and secondary replicas.
        /// Each replica includes a system-computed (output-only) state and primary
        /// designation.
        pub effective_replicas:
            std::vec::Vec<crate::model::listing::big_query_dataset_source::Replica>,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl BigQueryDatasetSource {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [dataset][crate::model::listing::BigQueryDatasetSource::dataset].
        pub fn set_dataset<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
            self.dataset = v.into();
            self
        }

        /// Sets the value of [selected_resources][crate::model::listing::BigQueryDatasetSource::selected_resources].
        pub fn set_selected_resources<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<
                    crate::model::listing::big_query_dataset_source::SelectedResource,
                >,
        {
            use std::iter::Iterator;
            self.selected_resources = v.into_iter().map(|i| i.into()).collect();
            self
        }

        /// Sets the value of [restricted_export_policy][crate::model::listing::BigQueryDatasetSource::restricted_export_policy].
        pub fn set_restricted_export_policy<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<
                    crate::model::listing::big_query_dataset_source::RestrictedExportPolicy,
                >,
        {
            self.restricted_export_policy = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [restricted_export_policy][crate::model::listing::BigQueryDatasetSource::restricted_export_policy].
        pub fn set_or_clear_restricted_export_policy<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<
                    crate::model::listing::big_query_dataset_source::RestrictedExportPolicy,
                >,
        {
            self.restricted_export_policy = v.map(|x| x.into());
            self
        }

        /// Sets the value of [replica_locations][crate::model::listing::BigQueryDatasetSource::replica_locations].
        pub fn set_replica_locations<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<std::string::String>,
        {
            use std::iter::Iterator;
            self.replica_locations = v.into_iter().map(|i| i.into()).collect();
            self
        }

        /// Sets the value of [effective_replicas][crate::model::listing::BigQueryDatasetSource::effective_replicas].
        pub fn set_effective_replicas<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<crate::model::listing::big_query_dataset_source::Replica>,
        {
            use std::iter::Iterator;
            self.effective_replicas = v.into_iter().map(|i| i.into()).collect();
            self
        }
    }

    impl wkt::message::Message for BigQueryDatasetSource {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.bigquery.analyticshub.v1.Listing.BigQueryDatasetSource"
        }
    }

    /// Defines additional types related to [BigQueryDatasetSource].
    pub mod big_query_dataset_source {
        #[allow(unused_imports)]
        use super::*;

        /// Resource in this dataset that is selectively shared.
        #[derive(Clone, Default, PartialEq)]
        #[non_exhaustive]
        pub struct SelectedResource {
            pub resource: std::option::Option<
                crate::model::listing::big_query_dataset_source::selected_resource::Resource,
            >,

            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
        }

        impl SelectedResource {
            pub fn new() -> Self {
                std::default::Default::default()
            }

            /// Sets the value of [resource][crate::model::listing::big_query_dataset_source::SelectedResource::resource].
            ///
            /// Note that all the setters affecting `resource` are mutually
            /// exclusive.
            pub fn set_resource<T: std::convert::Into<std::option::Option<crate::model::listing::big_query_dataset_source::selected_resource::Resource>>>(mut self, v: T) -> Self
            {
                self.resource = v.into();
                self
            }

            /// The value of [resource][crate::model::listing::big_query_dataset_source::SelectedResource::resource]
            /// if it holds a `Table`, `None` if the field is not set or
            /// holds a different branch.
            pub fn table(&self) -> std::option::Option<&std::string::String> {
                #[allow(unreachable_patterns)]
                self.resource.as_ref().and_then(|v| match v {
                    crate::model::listing::big_query_dataset_source::selected_resource::Resource::Table(v) => std::option::Option::Some(v),
                    _ => std::option::Option::None,
                })
            }

            /// Sets the value of [resource][crate::model::listing::big_query_dataset_source::SelectedResource::resource]
            /// to hold a `Table`.
            ///
            /// Note that all the setters affecting `resource` are
            /// mutually exclusive.
            pub fn set_table<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
                self.resource = std::option::Option::Some(
                    crate::model::listing::big_query_dataset_source::selected_resource::Resource::Table(
                        v.into()
                    )
                );
                self
            }

            /// The value of [resource][crate::model::listing::big_query_dataset_source::SelectedResource::resource]
            /// if it holds a `Routine`, `None` if the field is not set or
            /// holds a different branch.
            pub fn routine(&self) -> std::option::Option<&std::string::String> {
                #[allow(unreachable_patterns)]
                self.resource.as_ref().and_then(|v| match v {
                    crate::model::listing::big_query_dataset_source::selected_resource::Resource::Routine(v) => std::option::Option::Some(v),
                    _ => std::option::Option::None,
                })
            }

            /// Sets the value of [resource][crate::model::listing::big_query_dataset_source::SelectedResource::resource]
            /// to hold a `Routine`.
            ///
            /// Note that all the setters affecting `resource` are
            /// mutually exclusive.
            pub fn set_routine<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
                self.resource = std::option::Option::Some(
                    crate::model::listing::big_query_dataset_source::selected_resource::Resource::Routine(
                        v.into()
                    )
                );
                self
            }
        }

        impl wkt::message::Message for SelectedResource {
            fn typename() -> &'static str {
                "type.googleapis.com/google.cloud.bigquery.analyticshub.v1.Listing.BigQueryDatasetSource.SelectedResource"
            }
        }

        /// Defines additional types related to [SelectedResource].
        pub mod selected_resource {
            #[allow(unused_imports)]
            use super::*;

            #[derive(Clone, Debug, PartialEq)]
            #[non_exhaustive]
            pub enum Resource {
                /// Optional. Format:
                /// For table:
                /// `projects/{projectId}/datasets/{datasetId}/tables/{tableId}`
                /// Example:"projects/test_project/datasets/test_dataset/tables/test_table"
                Table(std::string::String),
                /// Optional. Format:
                /// For routine:
                /// `projects/{projectId}/datasets/{datasetId}/routines/{routineId}`
                /// Example:"projects/test_project/datasets/test_dataset/routines/test_routine"
                Routine(std::string::String),
            }
        }

        /// Restricted export policy used to configure restricted export on linked
        /// dataset.
        #[derive(Clone, Default, PartialEq)]
        #[non_exhaustive]
        pub struct RestrictedExportPolicy {
            /// Optional. If true, enable restricted export.
            pub enabled: std::option::Option<wkt::BoolValue>,

            /// Optional. If true, restrict direct table access (read
            /// api/tabledata.list) on linked table.
            pub restrict_direct_table_access: std::option::Option<wkt::BoolValue>,

            /// Optional. If true, restrict export of query result derived from
            /// restricted linked dataset table.
            pub restrict_query_result: std::option::Option<wkt::BoolValue>,

            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
        }

        impl RestrictedExportPolicy {
            pub fn new() -> Self {
                std::default::Default::default()
            }

            /// Sets the value of [enabled][crate::model::listing::big_query_dataset_source::RestrictedExportPolicy::enabled].
            pub fn set_enabled<T>(mut self, v: T) -> Self
            where
                T: std::convert::Into<wkt::BoolValue>,
            {
                self.enabled = std::option::Option::Some(v.into());
                self
            }

            /// Sets or clears the value of [enabled][crate::model::listing::big_query_dataset_source::RestrictedExportPolicy::enabled].
            pub fn set_or_clear_enabled<T>(mut self, v: std::option::Option<T>) -> Self
            where
                T: std::convert::Into<wkt::BoolValue>,
            {
                self.enabled = v.map(|x| x.into());
                self
            }

            /// Sets the value of [restrict_direct_table_access][crate::model::listing::big_query_dataset_source::RestrictedExportPolicy::restrict_direct_table_access].
            pub fn set_restrict_direct_table_access<T>(mut self, v: T) -> Self
            where
                T: std::convert::Into<wkt::BoolValue>,
            {
                self.restrict_direct_table_access = std::option::Option::Some(v.into());
                self
            }

            /// Sets or clears the value of [restrict_direct_table_access][crate::model::listing::big_query_dataset_source::RestrictedExportPolicy::restrict_direct_table_access].
            pub fn set_or_clear_restrict_direct_table_access<T>(
                mut self,
                v: std::option::Option<T>,
            ) -> Self
            where
                T: std::convert::Into<wkt::BoolValue>,
            {
                self.restrict_direct_table_access = v.map(|x| x.into());
                self
            }

            /// Sets the value of [restrict_query_result][crate::model::listing::big_query_dataset_source::RestrictedExportPolicy::restrict_query_result].
            pub fn set_restrict_query_result<T>(mut self, v: T) -> Self
            where
                T: std::convert::Into<wkt::BoolValue>,
            {
                self.restrict_query_result = std::option::Option::Some(v.into());
                self
            }

            /// Sets or clears the value of [restrict_query_result][crate::model::listing::big_query_dataset_source::RestrictedExportPolicy::restrict_query_result].
            pub fn set_or_clear_restrict_query_result<T>(
                mut self,
                v: std::option::Option<T>,
            ) -> Self
            where
                T: std::convert::Into<wkt::BoolValue>,
            {
                self.restrict_query_result = v.map(|x| x.into());
                self
            }
        }

        impl wkt::message::Message for RestrictedExportPolicy {
            fn typename() -> &'static str {
                "type.googleapis.com/google.cloud.bigquery.analyticshub.v1.Listing.BigQueryDatasetSource.RestrictedExportPolicy"
            }
        }

        /// Represents the state of a replica of a shared dataset.
        /// It includes the geographic location of the replica and
        /// system-computed, output-only fields indicating its replication state and
        /// whether it is the primary replica.
        #[derive(Clone, Default, PartialEq)]
        #[non_exhaustive]
        pub struct Replica {
            /// Output only. The geographic location where the replica resides. See
            /// [BigQuery locations](https://cloud.google.com/bigquery/docs/locations)
            /// for supported locations. Eg. "us-central1".
            pub location: std::string::String,

            /// Output only. Assigned by Analytics Hub based on real BigQuery
            /// replication state.
            pub replica_state:
                crate::model::listing::big_query_dataset_source::replica::ReplicaState,

            /// Output only. Indicates that this replica is the primary replica.
            pub primary_state: std::option::Option<
                crate::model::listing::big_query_dataset_source::replica::PrimaryState,
            >,

            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
        }

        impl Replica {
            pub fn new() -> Self {
                std::default::Default::default()
            }

            /// Sets the value of [location][crate::model::listing::big_query_dataset_source::Replica::location].
            pub fn set_location<T: std::convert::Into<std::string::String>>(
                mut self,
                v: T,
            ) -> Self {
                self.location = v.into();
                self
            }

            /// Sets the value of [replica_state][crate::model::listing::big_query_dataset_source::Replica::replica_state].
            pub fn set_replica_state<
                T: std::convert::Into<
                        crate::model::listing::big_query_dataset_source::replica::ReplicaState,
                    >,
            >(
                mut self,
                v: T,
            ) -> Self {
                self.replica_state = v.into();
                self
            }

            /// Sets the value of [primary_state][crate::model::listing::big_query_dataset_source::Replica::primary_state].
            pub fn set_primary_state<T>(mut self, v: T) -> Self
            where
                T: std::convert::Into<
                        crate::model::listing::big_query_dataset_source::replica::PrimaryState,
                    >,
            {
                self.primary_state = std::option::Option::Some(v.into());
                self
            }

            /// Sets or clears the value of [primary_state][crate::model::listing::big_query_dataset_source::Replica::primary_state].
            pub fn set_or_clear_primary_state<T>(mut self, v: std::option::Option<T>) -> Self
            where
                T: std::convert::Into<
                        crate::model::listing::big_query_dataset_source::replica::PrimaryState,
                    >,
            {
                self.primary_state = v.map(|x| x.into());
                self
            }
        }

        impl wkt::message::Message for Replica {
            fn typename() -> &'static str {
                "type.googleapis.com/google.cloud.bigquery.analyticshub.v1.Listing.BigQueryDatasetSource.Replica"
            }
        }

        /// Defines additional types related to [Replica].
        pub mod replica {
            #[allow(unused_imports)]
            use super::*;

            /// Replica state of the shared dataset.
            ///
            /// # Working with unknown values
            ///
            /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
            /// additional enum variants at any time. Adding new variants is not considered
            /// a breaking change. Applications should write their code in anticipation of:
            ///
            /// - New values appearing in future releases of the client library, **and**
            /// - New values received dynamically, without application changes.
            ///
            /// Please consult the [Working with enums] section in the user guide for some
            /// guidelines.
            ///
            /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
            #[derive(Clone, Debug, PartialEq)]
            #[non_exhaustive]
            pub enum ReplicaState {
                /// Default value. This value is unused.
                Unspecified,
                /// The replica is backfilled and ready to use.
                ReadyToUse,
                /// The replica is unavailable, does not exist, or has not been
                /// backfilled yet.
                Unavailable,
                /// If set, the enum was initialized with an unknown value.
                ///
                /// Applications can examine the value using [ReplicaState::value] or
                /// [ReplicaState::name].
                UnknownValue(replica_state::UnknownValue),
            }

            #[doc(hidden)]
            pub mod replica_state {
                #[allow(unused_imports)]
                use super::*;
                #[derive(Clone, Debug, PartialEq)]
                pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
            }

            impl ReplicaState {
                /// Gets the enum value.
                ///
                /// Returns `None` if the enum contains an unknown value deserialized from
                /// the string representation of enums.
                pub fn value(&self) -> std::option::Option<i32> {
                    match self {
                        Self::Unspecified => std::option::Option::Some(0),
                        Self::ReadyToUse => std::option::Option::Some(1),
                        Self::Unavailable => std::option::Option::Some(2),
                        Self::UnknownValue(u) => u.0.value(),
                    }
                }

                /// Gets the enum value as a string.
                ///
                /// Returns `None` if the enum contains an unknown value deserialized from
                /// the integer representation of enums.
                pub fn name(&self) -> std::option::Option<&str> {
                    match self {
                        Self::Unspecified => std::option::Option::Some("REPLICA_STATE_UNSPECIFIED"),
                        Self::ReadyToUse => std::option::Option::Some("READY_TO_USE"),
                        Self::Unavailable => std::option::Option::Some("UNAVAILABLE"),
                        Self::UnknownValue(u) => u.0.name(),
                    }
                }
            }

            impl std::default::Default for ReplicaState {
                fn default() -> Self {
                    use std::convert::From;
                    Self::from(0)
                }
            }

            impl std::fmt::Display for ReplicaState {
                fn fmt(
                    &self,
                    f: &mut std::fmt::Formatter<'_>,
                ) -> std::result::Result<(), std::fmt::Error> {
                    wkt::internal::display_enum(f, self.name(), self.value())
                }
            }

            impl std::convert::From<i32> for ReplicaState {
                fn from(value: i32) -> Self {
                    match value {
                        0 => Self::Unspecified,
                        1 => Self::ReadyToUse,
                        2 => Self::Unavailable,
                        _ => Self::UnknownValue(replica_state::UnknownValue(
                            wkt::internal::UnknownEnumValue::Integer(value),
                        )),
                    }
                }
            }

            impl std::convert::From<&str> for ReplicaState {
                fn from(value: &str) -> Self {
                    use std::string::ToString;
                    match value {
                        "REPLICA_STATE_UNSPECIFIED" => Self::Unspecified,
                        "READY_TO_USE" => Self::ReadyToUse,
                        "UNAVAILABLE" => Self::Unavailable,
                        _ => Self::UnknownValue(replica_state::UnknownValue(
                            wkt::internal::UnknownEnumValue::String(value.to_string()),
                        )),
                    }
                }
            }

            impl serde::ser::Serialize for ReplicaState {
                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
                where
                    S: serde::Serializer,
                {
                    match self {
                        Self::Unspecified => serializer.serialize_i32(0),
                        Self::ReadyToUse => serializer.serialize_i32(1),
                        Self::Unavailable => serializer.serialize_i32(2),
                        Self::UnknownValue(u) => u.0.serialize(serializer),
                    }
                }
            }

            impl<'de> serde::de::Deserialize<'de> for ReplicaState {
                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
                where
                    D: serde::Deserializer<'de>,
                {
                    deserializer.deserialize_any(wkt::internal::EnumVisitor::<ReplicaState>::new(
                        ".google.cloud.bigquery.analyticshub.v1.Listing.BigQueryDatasetSource.Replica.ReplicaState"))
                }
            }

            /// Primary state of the replica. Set only for the primary replica.
            ///
            /// # Working with unknown values
            ///
            /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
            /// additional enum variants at any time. Adding new variants is not considered
            /// a breaking change. Applications should write their code in anticipation of:
            ///
            /// - New values appearing in future releases of the client library, **and**
            /// - New values received dynamically, without application changes.
            ///
            /// Please consult the [Working with enums] section in the user guide for some
            /// guidelines.
            ///
            /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
            #[derive(Clone, Debug, PartialEq)]
            #[non_exhaustive]
            pub enum PrimaryState {
                /// Default value. This value is unused.
                Unspecified,
                /// The replica is the primary replica.
                PrimaryReplica,
                /// If set, the enum was initialized with an unknown value.
                ///
                /// Applications can examine the value using [PrimaryState::value] or
                /// [PrimaryState::name].
                UnknownValue(primary_state::UnknownValue),
            }

            #[doc(hidden)]
            pub mod primary_state {
                #[allow(unused_imports)]
                use super::*;
                #[derive(Clone, Debug, PartialEq)]
                pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
            }

            impl PrimaryState {
                /// Gets the enum value.
                ///
                /// Returns `None` if the enum contains an unknown value deserialized from
                /// the string representation of enums.
                pub fn value(&self) -> std::option::Option<i32> {
                    match self {
                        Self::Unspecified => std::option::Option::Some(0),
                        Self::PrimaryReplica => std::option::Option::Some(1),
                        Self::UnknownValue(u) => u.0.value(),
                    }
                }

                /// Gets the enum value as a string.
                ///
                /// Returns `None` if the enum contains an unknown value deserialized from
                /// the integer representation of enums.
                pub fn name(&self) -> std::option::Option<&str> {
                    match self {
                        Self::Unspecified => std::option::Option::Some("PRIMARY_STATE_UNSPECIFIED"),
                        Self::PrimaryReplica => std::option::Option::Some("PRIMARY_REPLICA"),
                        Self::UnknownValue(u) => u.0.name(),
                    }
                }
            }

            impl std::default::Default for PrimaryState {
                fn default() -> Self {
                    use std::convert::From;
                    Self::from(0)
                }
            }

            impl std::fmt::Display for PrimaryState {
                fn fmt(
                    &self,
                    f: &mut std::fmt::Formatter<'_>,
                ) -> std::result::Result<(), std::fmt::Error> {
                    wkt::internal::display_enum(f, self.name(), self.value())
                }
            }

            impl std::convert::From<i32> for PrimaryState {
                fn from(value: i32) -> Self {
                    match value {
                        0 => Self::Unspecified,
                        1 => Self::PrimaryReplica,
                        _ => Self::UnknownValue(primary_state::UnknownValue(
                            wkt::internal::UnknownEnumValue::Integer(value),
                        )),
                    }
                }
            }

            impl std::convert::From<&str> for PrimaryState {
                fn from(value: &str) -> Self {
                    use std::string::ToString;
                    match value {
                        "PRIMARY_STATE_UNSPECIFIED" => Self::Unspecified,
                        "PRIMARY_REPLICA" => Self::PrimaryReplica,
                        _ => Self::UnknownValue(primary_state::UnknownValue(
                            wkt::internal::UnknownEnumValue::String(value.to_string()),
                        )),
                    }
                }
            }

            impl serde::ser::Serialize for PrimaryState {
                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
                where
                    S: serde::Serializer,
                {
                    match self {
                        Self::Unspecified => serializer.serialize_i32(0),
                        Self::PrimaryReplica => serializer.serialize_i32(1),
                        Self::UnknownValue(u) => u.0.serialize(serializer),
                    }
                }
            }

            impl<'de> serde::de::Deserialize<'de> for PrimaryState {
                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
                where
                    D: serde::Deserializer<'de>,
                {
                    deserializer.deserialize_any(wkt::internal::EnumVisitor::<PrimaryState>::new(
                        ".google.cloud.bigquery.analyticshub.v1.Listing.BigQueryDatasetSource.Replica.PrimaryState"))
                }
            }
        }
    }

    /// Pub/Sub topic source.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct PubSubTopicSource {
        /// Required. Resource name of the Pub/Sub topic source for this listing.
        /// e.g. projects/myproject/topics/topicId
        pub topic: std::string::String,

        /// Optional. Region hint on where the data might be published. Data affinity
        /// regions are modifiable. See <https://cloud.google.com/about/locations> for
        /// full listing of possible Cloud regions.
        pub data_affinity_regions: std::vec::Vec<std::string::String>,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl PubSubTopicSource {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [topic][crate::model::listing::PubSubTopicSource::topic].
        pub fn set_topic<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
            self.topic = v.into();
            self
        }

        /// Sets the value of [data_affinity_regions][crate::model::listing::PubSubTopicSource::data_affinity_regions].
        pub fn set_data_affinity_regions<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<std::string::String>,
        {
            use std::iter::Iterator;
            self.data_affinity_regions = v.into_iter().map(|i| i.into()).collect();
            self
        }
    }

    impl wkt::message::Message for PubSubTopicSource {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.bigquery.analyticshub.v1.Listing.PubSubTopicSource"
        }
    }

    /// Restricted export config, used to configure restricted export on linked
    /// dataset.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct RestrictedExportConfig {
        /// Optional. If true, enable restricted export.
        pub enabled: bool,

        /// Output only. If true, restrict direct table access(read
        /// api/tabledata.list) on linked table.
        pub restrict_direct_table_access: bool,

        /// Optional. If true, restrict export of query result derived from
        /// restricted linked dataset table.
        pub restrict_query_result: bool,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl RestrictedExportConfig {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [enabled][crate::model::listing::RestrictedExportConfig::enabled].
        pub fn set_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
            self.enabled = v.into();
            self
        }

        /// Sets the value of [restrict_direct_table_access][crate::model::listing::RestrictedExportConfig::restrict_direct_table_access].
        pub fn set_restrict_direct_table_access<T: std::convert::Into<bool>>(
            mut self,
            v: T,
        ) -> Self {
            self.restrict_direct_table_access = v.into();
            self
        }

        /// Sets the value of [restrict_query_result][crate::model::listing::RestrictedExportConfig::restrict_query_result].
        pub fn set_restrict_query_result<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
            self.restrict_query_result = v.into();
            self
        }
    }

    impl wkt::message::Message for RestrictedExportConfig {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.bigquery.analyticshub.v1.Listing.RestrictedExportConfig"
        }
    }

    /// Commercial info contains the information about the commercial data products
    /// associated with the listing.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct CommercialInfo {
        /// Output only. Details of the Marketplace Data Product associated with the
        /// Listing.
        pub cloud_marketplace:
            std::option::Option<crate::model::listing::commercial_info::GoogleCloudMarketplaceInfo>,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl CommercialInfo {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [cloud_marketplace][crate::model::listing::CommercialInfo::cloud_marketplace].
        pub fn set_cloud_marketplace<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<
                    crate::model::listing::commercial_info::GoogleCloudMarketplaceInfo,
                >,
        {
            self.cloud_marketplace = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [cloud_marketplace][crate::model::listing::CommercialInfo::cloud_marketplace].
        pub fn set_or_clear_cloud_marketplace<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<
                    crate::model::listing::commercial_info::GoogleCloudMarketplaceInfo,
                >,
        {
            self.cloud_marketplace = v.map(|x| x.into());
            self
        }
    }

    impl wkt::message::Message for CommercialInfo {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.bigquery.analyticshub.v1.Listing.CommercialInfo"
        }
    }

    /// Defines additional types related to [CommercialInfo].
    pub mod commercial_info {
        #[allow(unused_imports)]
        use super::*;

        /// Specifies the details of the Marketplace Data Product associated with the
        /// Listing.
        #[derive(Clone, Default, PartialEq)]
        #[non_exhaustive]
        pub struct GoogleCloudMarketplaceInfo {

            /// Output only. Resource name of the commercial service associated with
            /// the Marketplace Data Product. e.g. example.com
            pub service: std::option::Option<std::string::String>,

            /// Output only. Commercial state of the Marketplace Data Product.
            pub commercial_state: std::option::Option<crate::model::listing::commercial_info::google_cloud_marketplace_info::CommercialState>,

            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
        }

        impl GoogleCloudMarketplaceInfo {
            pub fn new() -> Self {
                std::default::Default::default()
            }

            /// Sets the value of [service][crate::model::listing::commercial_info::GoogleCloudMarketplaceInfo::service].
            pub fn set_service<T>(mut self, v: T) -> Self
            where
                T: std::convert::Into<std::string::String>,
            {
                self.service = std::option::Option::Some(v.into());
                self
            }

            /// Sets or clears the value of [service][crate::model::listing::commercial_info::GoogleCloudMarketplaceInfo::service].
            pub fn set_or_clear_service<T>(mut self, v: std::option::Option<T>) -> Self
            where
                T: std::convert::Into<std::string::String>,
            {
                self.service = v.map(|x| x.into());
                self
            }

            /// Sets the value of [commercial_state][crate::model::listing::commercial_info::GoogleCloudMarketplaceInfo::commercial_state].
            pub fn set_commercial_state<T>(mut self, v: T) -> Self
            where T: std::convert::Into<crate::model::listing::commercial_info::google_cloud_marketplace_info::CommercialState>
            {
                self.commercial_state = std::option::Option::Some(v.into());
                self
            }

            /// Sets or clears the value of [commercial_state][crate::model::listing::commercial_info::GoogleCloudMarketplaceInfo::commercial_state].
            pub fn set_or_clear_commercial_state<T>(mut self, v: std::option::Option<T>) -> Self
            where T: std::convert::Into<crate::model::listing::commercial_info::google_cloud_marketplace_info::CommercialState>
            {
                self.commercial_state = v.map(|x| x.into());
                self
            }
        }

        impl wkt::message::Message for GoogleCloudMarketplaceInfo {
            fn typename() -> &'static str {
                "type.googleapis.com/google.cloud.bigquery.analyticshub.v1.Listing.CommercialInfo.GoogleCloudMarketplaceInfo"
            }
        }

        /// Defines additional types related to [GoogleCloudMarketplaceInfo].
        pub mod google_cloud_marketplace_info {
            #[allow(unused_imports)]
            use super::*;

            /// Indicates whether this commercial access is currently active.
            ///
            /// # Working with unknown values
            ///
            /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
            /// additional enum variants at any time. Adding new variants is not considered
            /// a breaking change. Applications should write their code in anticipation of:
            ///
            /// - New values appearing in future releases of the client library, **and**
            /// - New values received dynamically, without application changes.
            ///
            /// Please consult the [Working with enums] section in the user guide for some
            /// guidelines.
            ///
            /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
            #[derive(Clone, Debug, PartialEq)]
            #[non_exhaustive]
            pub enum CommercialState {
                /// Commercialization is incomplete and cannot be used.
                Unspecified,
                /// Commercialization has been initialized.
                Onboarding,
                /// Commercialization is complete and available for use.
                Active,
                /// If set, the enum was initialized with an unknown value.
                ///
                /// Applications can examine the value using [CommercialState::value] or
                /// [CommercialState::name].
                UnknownValue(commercial_state::UnknownValue),
            }

            #[doc(hidden)]
            pub mod commercial_state {
                #[allow(unused_imports)]
                use super::*;
                #[derive(Clone, Debug, PartialEq)]
                pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
            }

            impl CommercialState {
                /// Gets the enum value.
                ///
                /// Returns `None` if the enum contains an unknown value deserialized from
                /// the string representation of enums.
                pub fn value(&self) -> std::option::Option<i32> {
                    match self {
                        Self::Unspecified => std::option::Option::Some(0),
                        Self::Onboarding => std::option::Option::Some(1),
                        Self::Active => std::option::Option::Some(2),
                        Self::UnknownValue(u) => u.0.value(),
                    }
                }

                /// Gets the enum value as a string.
                ///
                /// Returns `None` if the enum contains an unknown value deserialized from
                /// the integer representation of enums.
                pub fn name(&self) -> std::option::Option<&str> {
                    match self {
                        Self::Unspecified => {
                            std::option::Option::Some("COMMERCIAL_STATE_UNSPECIFIED")
                        }
                        Self::Onboarding => std::option::Option::Some("ONBOARDING"),
                        Self::Active => std::option::Option::Some("ACTIVE"),
                        Self::UnknownValue(u) => u.0.name(),
                    }
                }
            }

            impl std::default::Default for CommercialState {
                fn default() -> Self {
                    use std::convert::From;
                    Self::from(0)
                }
            }

            impl std::fmt::Display for CommercialState {
                fn fmt(
                    &self,
                    f: &mut std::fmt::Formatter<'_>,
                ) -> std::result::Result<(), std::fmt::Error> {
                    wkt::internal::display_enum(f, self.name(), self.value())
                }
            }

            impl std::convert::From<i32> for CommercialState {
                fn from(value: i32) -> Self {
                    match value {
                        0 => Self::Unspecified,
                        1 => Self::Onboarding,
                        2 => Self::Active,
                        _ => Self::UnknownValue(commercial_state::UnknownValue(
                            wkt::internal::UnknownEnumValue::Integer(value),
                        )),
                    }
                }
            }

            impl std::convert::From<&str> for CommercialState {
                fn from(value: &str) -> Self {
                    use std::string::ToString;
                    match value {
                        "COMMERCIAL_STATE_UNSPECIFIED" => Self::Unspecified,
                        "ONBOARDING" => Self::Onboarding,
                        "ACTIVE" => Self::Active,
                        _ => Self::UnknownValue(commercial_state::UnknownValue(
                            wkt::internal::UnknownEnumValue::String(value.to_string()),
                        )),
                    }
                }
            }

            impl serde::ser::Serialize for CommercialState {
                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
                where
                    S: serde::Serializer,
                {
                    match self {
                        Self::Unspecified => serializer.serialize_i32(0),
                        Self::Onboarding => serializer.serialize_i32(1),
                        Self::Active => serializer.serialize_i32(2),
                        Self::UnknownValue(u) => u.0.serialize(serializer),
                    }
                }
            }

            impl<'de> serde::de::Deserialize<'de> for CommercialState {
                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
                where
                    D: serde::Deserializer<'de>,
                {
                    deserializer.deserialize_any(wkt::internal::EnumVisitor::<CommercialState>::new(
                        ".google.cloud.bigquery.analyticshub.v1.Listing.CommercialInfo.GoogleCloudMarketplaceInfo.CommercialState"))
                }
            }
        }
    }

    /// State of the listing.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum State {
        /// Default value. This value is unused.
        Unspecified,
        /// Subscribable state. Users with dataexchange.listings.subscribe permission
        /// can subscribe to this listing.
        Active,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [State::value] or
        /// [State::name].
        UnknownValue(state::UnknownValue),
    }

    #[doc(hidden)]
    pub mod state {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl State {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::Active => std::option::Option::Some(1),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
                Self::Active => std::option::Option::Some("ACTIVE"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for State {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for State {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for State {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::Active,
                _ => Self::UnknownValue(state::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for State {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "STATE_UNSPECIFIED" => Self::Unspecified,
                "ACTIVE" => Self::Active,
                _ => Self::UnknownValue(state::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for State {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::Active => serializer.serialize_i32(1),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for State {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
                ".google.cloud.bigquery.analyticshub.v1.Listing.State",
            ))
        }
    }

    /// Listing categories.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum Category {
        Unspecified,
        Others,
        AdvertisingAndMarketing,
        Commerce,
        ClimateAndEnvironment,
        Demographics,
        Economics,
        Education,
        Energy,
        Financial,
        Gaming,
        Geospatial,
        HealthcareAndLifeScience,
        Media,
        PublicSector,
        Retail,
        Sports,
        ScienceAndResearch,
        TransportationAndLogistics,
        TravelAndTourism,
        GoogleEarthEngine,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [Category::value] or
        /// [Category::name].
        UnknownValue(category::UnknownValue),
    }

    #[doc(hidden)]
    pub mod category {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl Category {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::Others => std::option::Option::Some(1),
                Self::AdvertisingAndMarketing => std::option::Option::Some(2),
                Self::Commerce => std::option::Option::Some(3),
                Self::ClimateAndEnvironment => std::option::Option::Some(4),
                Self::Demographics => std::option::Option::Some(5),
                Self::Economics => std::option::Option::Some(6),
                Self::Education => std::option::Option::Some(7),
                Self::Energy => std::option::Option::Some(8),
                Self::Financial => std::option::Option::Some(9),
                Self::Gaming => std::option::Option::Some(10),
                Self::Geospatial => std::option::Option::Some(11),
                Self::HealthcareAndLifeScience => std::option::Option::Some(12),
                Self::Media => std::option::Option::Some(13),
                Self::PublicSector => std::option::Option::Some(14),
                Self::Retail => std::option::Option::Some(15),
                Self::Sports => std::option::Option::Some(16),
                Self::ScienceAndResearch => std::option::Option::Some(17),
                Self::TransportationAndLogistics => std::option::Option::Some(18),
                Self::TravelAndTourism => std::option::Option::Some(19),
                Self::GoogleEarthEngine => std::option::Option::Some(20),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("CATEGORY_UNSPECIFIED"),
                Self::Others => std::option::Option::Some("CATEGORY_OTHERS"),
                Self::AdvertisingAndMarketing => {
                    std::option::Option::Some("CATEGORY_ADVERTISING_AND_MARKETING")
                }
                Self::Commerce => std::option::Option::Some("CATEGORY_COMMERCE"),
                Self::ClimateAndEnvironment => {
                    std::option::Option::Some("CATEGORY_CLIMATE_AND_ENVIRONMENT")
                }
                Self::Demographics => std::option::Option::Some("CATEGORY_DEMOGRAPHICS"),
                Self::Economics => std::option::Option::Some("CATEGORY_ECONOMICS"),
                Self::Education => std::option::Option::Some("CATEGORY_EDUCATION"),
                Self::Energy => std::option::Option::Some("CATEGORY_ENERGY"),
                Self::Financial => std::option::Option::Some("CATEGORY_FINANCIAL"),
                Self::Gaming => std::option::Option::Some("CATEGORY_GAMING"),
                Self::Geospatial => std::option::Option::Some("CATEGORY_GEOSPATIAL"),
                Self::HealthcareAndLifeScience => {
                    std::option::Option::Some("CATEGORY_HEALTHCARE_AND_LIFE_SCIENCE")
                }
                Self::Media => std::option::Option::Some("CATEGORY_MEDIA"),
                Self::PublicSector => std::option::Option::Some("CATEGORY_PUBLIC_SECTOR"),
                Self::Retail => std::option::Option::Some("CATEGORY_RETAIL"),
                Self::Sports => std::option::Option::Some("CATEGORY_SPORTS"),
                Self::ScienceAndResearch => {
                    std::option::Option::Some("CATEGORY_SCIENCE_AND_RESEARCH")
                }
                Self::TransportationAndLogistics => {
                    std::option::Option::Some("CATEGORY_TRANSPORTATION_AND_LOGISTICS")
                }
                Self::TravelAndTourism => std::option::Option::Some("CATEGORY_TRAVEL_AND_TOURISM"),
                Self::GoogleEarthEngine => {
                    std::option::Option::Some("CATEGORY_GOOGLE_EARTH_ENGINE")
                }
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for Category {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for Category {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for Category {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::Others,
                2 => Self::AdvertisingAndMarketing,
                3 => Self::Commerce,
                4 => Self::ClimateAndEnvironment,
                5 => Self::Demographics,
                6 => Self::Economics,
                7 => Self::Education,
                8 => Self::Energy,
                9 => Self::Financial,
                10 => Self::Gaming,
                11 => Self::Geospatial,
                12 => Self::HealthcareAndLifeScience,
                13 => Self::Media,
                14 => Self::PublicSector,
                15 => Self::Retail,
                16 => Self::Sports,
                17 => Self::ScienceAndResearch,
                18 => Self::TransportationAndLogistics,
                19 => Self::TravelAndTourism,
                20 => Self::GoogleEarthEngine,
                _ => Self::UnknownValue(category::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for Category {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "CATEGORY_UNSPECIFIED" => Self::Unspecified,
                "CATEGORY_OTHERS" => Self::Others,
                "CATEGORY_ADVERTISING_AND_MARKETING" => Self::AdvertisingAndMarketing,
                "CATEGORY_COMMERCE" => Self::Commerce,
                "CATEGORY_CLIMATE_AND_ENVIRONMENT" => Self::ClimateAndEnvironment,
                "CATEGORY_DEMOGRAPHICS" => Self::Demographics,
                "CATEGORY_ECONOMICS" => Self::Economics,
                "CATEGORY_EDUCATION" => Self::Education,
                "CATEGORY_ENERGY" => Self::Energy,
                "CATEGORY_FINANCIAL" => Self::Financial,
                "CATEGORY_GAMING" => Self::Gaming,
                "CATEGORY_GEOSPATIAL" => Self::Geospatial,
                "CATEGORY_HEALTHCARE_AND_LIFE_SCIENCE" => Self::HealthcareAndLifeScience,
                "CATEGORY_MEDIA" => Self::Media,
                "CATEGORY_PUBLIC_SECTOR" => Self::PublicSector,
                "CATEGORY_RETAIL" => Self::Retail,
                "CATEGORY_SPORTS" => Self::Sports,
                "CATEGORY_SCIENCE_AND_RESEARCH" => Self::ScienceAndResearch,
                "CATEGORY_TRANSPORTATION_AND_LOGISTICS" => Self::TransportationAndLogistics,
                "CATEGORY_TRAVEL_AND_TOURISM" => Self::TravelAndTourism,
                "CATEGORY_GOOGLE_EARTH_ENGINE" => Self::GoogleEarthEngine,
                _ => Self::UnknownValue(category::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for Category {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::Others => serializer.serialize_i32(1),
                Self::AdvertisingAndMarketing => serializer.serialize_i32(2),
                Self::Commerce => serializer.serialize_i32(3),
                Self::ClimateAndEnvironment => serializer.serialize_i32(4),
                Self::Demographics => serializer.serialize_i32(5),
                Self::Economics => serializer.serialize_i32(6),
                Self::Education => serializer.serialize_i32(7),
                Self::Energy => serializer.serialize_i32(8),
                Self::Financial => serializer.serialize_i32(9),
                Self::Gaming => serializer.serialize_i32(10),
                Self::Geospatial => serializer.serialize_i32(11),
                Self::HealthcareAndLifeScience => serializer.serialize_i32(12),
                Self::Media => serializer.serialize_i32(13),
                Self::PublicSector => serializer.serialize_i32(14),
                Self::Retail => serializer.serialize_i32(15),
                Self::Sports => serializer.serialize_i32(16),
                Self::ScienceAndResearch => serializer.serialize_i32(17),
                Self::TransportationAndLogistics => serializer.serialize_i32(18),
                Self::TravelAndTourism => serializer.serialize_i32(19),
                Self::GoogleEarthEngine => serializer.serialize_i32(20),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for Category {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Category>::new(
                ".google.cloud.bigquery.analyticshub.v1.Listing.Category",
            ))
        }
    }

    /// Listing source.
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum Source {
        /// Shared dataset i.e. BigQuery dataset source.
        BigqueryDataset(std::boxed::Box<crate::model::listing::BigQueryDatasetSource>),
        /// Pub/Sub topic source.
        PubsubTopic(std::boxed::Box<crate::model::listing::PubSubTopicSource>),
    }
}

/// Stored procedure configuration, used to configure stored procedure sharing
/// on linked dataset.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct StoredProcedureConfig {
    /// Optional. If true, enable sharing of stored procedure.
    pub enabled: bool,

    /// Output only. Types of stored procedure supported to share.
    pub allowed_stored_procedure_types:
        std::vec::Vec<crate::model::stored_procedure_config::StoredProcedureType>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl StoredProcedureConfig {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [enabled][crate::model::StoredProcedureConfig::enabled].
    pub fn set_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.enabled = v.into();
        self
    }

    /// Sets the value of [allowed_stored_procedure_types][crate::model::StoredProcedureConfig::allowed_stored_procedure_types].
    pub fn set_allowed_stored_procedure_types<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::stored_procedure_config::StoredProcedureType>,
    {
        use std::iter::Iterator;
        self.allowed_stored_procedure_types = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for StoredProcedureConfig {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.bigquery.analyticshub.v1.StoredProcedureConfig"
    }
}

/// Defines additional types related to [StoredProcedureConfig].
pub mod stored_procedure_config {
    #[allow(unused_imports)]
    use super::*;

    /// Enum to specify the type of stored procedure to share.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum StoredProcedureType {
        /// Default value. This value is unused.
        Unspecified,
        /// SQL stored procedure.
        SqlProcedure,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [StoredProcedureType::value] or
        /// [StoredProcedureType::name].
        UnknownValue(stored_procedure_type::UnknownValue),
    }

    #[doc(hidden)]
    pub mod stored_procedure_type {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl StoredProcedureType {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::SqlProcedure => std::option::Option::Some(1),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("STORED_PROCEDURE_TYPE_UNSPECIFIED"),
                Self::SqlProcedure => std::option::Option::Some("SQL_PROCEDURE"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for StoredProcedureType {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for StoredProcedureType {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for StoredProcedureType {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::SqlProcedure,
                _ => Self::UnknownValue(stored_procedure_type::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for StoredProcedureType {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "STORED_PROCEDURE_TYPE_UNSPECIFIED" => Self::Unspecified,
                "SQL_PROCEDURE" => Self::SqlProcedure,
                _ => Self::UnknownValue(stored_procedure_type::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for StoredProcedureType {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::SqlProcedure => serializer.serialize_i32(1),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for StoredProcedureType {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<StoredProcedureType>::new(
                ".google.cloud.bigquery.analyticshub.v1.StoredProcedureConfig.StoredProcedureType",
            ))
        }
    }
}

/// A subscription represents a subscribers' access to a particular set of
/// published data. It contains references to associated listings,
/// data exchanges, and linked datasets.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Subscription {
    /// Output only. The resource name of the subscription.
    /// e.g. `projects/myproject/locations/us/subscriptions/123`.
    pub name: std::string::String,

    /// Output only. Timestamp when the subscription was created.
    pub creation_time: std::option::Option<wkt::Timestamp>,

    /// Output only. Timestamp when the subscription was last modified.
    pub last_modify_time: std::option::Option<wkt::Timestamp>,

    /// Output only. Organization of the project this subscription belongs to.
    pub organization_id: std::string::String,

    /// Output only. Display name of the project of this subscription.
    pub organization_display_name: std::string::String,

    /// Output only. Current state of the subscription.
    pub state: crate::model::subscription::State,

    /// Output only. Map of listing resource names to associated linked resource,
    /// e.g. projects/123/locations/us/dataExchanges/456/listings/789
    /// ->
    /// projects/123/datasets/my_dataset
    ///
    /// For listing-level subscriptions, this is a map of size 1.
    /// Only contains values if state == STATE_ACTIVE.
    pub linked_dataset_map:
        std::collections::HashMap<std::string::String, crate::model::subscription::LinkedResource>,

    /// Output only. Email of the subscriber.
    pub subscriber_contact: std::string::String,

    /// Output only. Linked resources created in the subscription. Only contains
    /// values if state = STATE_ACTIVE.
    pub linked_resources: std::vec::Vec<crate::model::subscription::LinkedResource>,

    /// Output only. Listing shared asset type.
    pub resource_type: crate::model::SharedResourceType,

    /// Output only. This is set if this is a commercial subscription i.e. if this
    /// subscription was created from subscribing to a commercial listing.
    pub commercial_info: std::option::Option<crate::model::subscription::CommercialInfo>,

    /// Output only. By default, false.
    /// If true, the Subscriber agreed to the email sharing mandate
    /// that is enabled for DataExchange/Listing.
    pub log_linked_dataset_query_user_email: std::option::Option<bool>,

    /// Optional. BigQuery destination dataset to create for the subscriber.
    pub destination_dataset: std::option::Option<crate::model::DestinationDataset>,

    pub resource_name: std::option::Option<crate::model::subscription::ResourceName>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl Subscription {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::Subscription::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [creation_time][crate::model::Subscription::creation_time].
    pub fn set_creation_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.creation_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [creation_time][crate::model::Subscription::creation_time].
    pub fn set_or_clear_creation_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.creation_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [last_modify_time][crate::model::Subscription::last_modify_time].
    pub fn set_last_modify_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.last_modify_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [last_modify_time][crate::model::Subscription::last_modify_time].
    pub fn set_or_clear_last_modify_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.last_modify_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [organization_id][crate::model::Subscription::organization_id].
    pub fn set_organization_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.organization_id = v.into();
        self
    }

    /// Sets the value of [organization_display_name][crate::model::Subscription::organization_display_name].
    pub fn set_organization_display_name<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.organization_display_name = v.into();
        self
    }

    /// Sets the value of [state][crate::model::Subscription::state].
    pub fn set_state<T: std::convert::Into<crate::model::subscription::State>>(
        mut self,
        v: T,
    ) -> Self {
        self.state = v.into();
        self
    }

    /// Sets the value of [linked_dataset_map][crate::model::Subscription::linked_dataset_map].
    pub fn set_linked_dataset_map<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<crate::model::subscription::LinkedResource>,
    {
        use std::iter::Iterator;
        self.linked_dataset_map = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }

    /// Sets the value of [subscriber_contact][crate::model::Subscription::subscriber_contact].
    pub fn set_subscriber_contact<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.subscriber_contact = v.into();
        self
    }

    /// Sets the value of [linked_resources][crate::model::Subscription::linked_resources].
    pub fn set_linked_resources<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::subscription::LinkedResource>,
    {
        use std::iter::Iterator;
        self.linked_resources = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [resource_type][crate::model::Subscription::resource_type].
    pub fn set_resource_type<T: std::convert::Into<crate::model::SharedResourceType>>(
        mut self,
        v: T,
    ) -> Self {
        self.resource_type = v.into();
        self
    }

    /// Sets the value of [commercial_info][crate::model::Subscription::commercial_info].
    pub fn set_commercial_info<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::subscription::CommercialInfo>,
    {
        self.commercial_info = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [commercial_info][crate::model::Subscription::commercial_info].
    pub fn set_or_clear_commercial_info<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::subscription::CommercialInfo>,
    {
        self.commercial_info = v.map(|x| x.into());
        self
    }

    /// Sets the value of [log_linked_dataset_query_user_email][crate::model::Subscription::log_linked_dataset_query_user_email].
    pub fn set_log_linked_dataset_query_user_email<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<bool>,
    {
        self.log_linked_dataset_query_user_email = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [log_linked_dataset_query_user_email][crate::model::Subscription::log_linked_dataset_query_user_email].
    pub fn set_or_clear_log_linked_dataset_query_user_email<T>(
        mut self,
        v: std::option::Option<T>,
    ) -> Self
    where
        T: std::convert::Into<bool>,
    {
        self.log_linked_dataset_query_user_email = v.map(|x| x.into());
        self
    }

    /// Sets the value of [destination_dataset][crate::model::Subscription::destination_dataset].
    pub fn set_destination_dataset<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::DestinationDataset>,
    {
        self.destination_dataset = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [destination_dataset][crate::model::Subscription::destination_dataset].
    pub fn set_or_clear_destination_dataset<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::DestinationDataset>,
    {
        self.destination_dataset = v.map(|x| x.into());
        self
    }

    /// Sets the value of [resource_name][crate::model::Subscription::resource_name].
    ///
    /// Note that all the setters affecting `resource_name` are mutually
    /// exclusive.
    pub fn set_resource_name<
        T: std::convert::Into<std::option::Option<crate::model::subscription::ResourceName>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.resource_name = v.into();
        self
    }

    /// The value of [resource_name][crate::model::Subscription::resource_name]
    /// if it holds a `Listing`, `None` if the field is not set or
    /// holds a different branch.
    pub fn listing(&self) -> std::option::Option<&std::string::String> {
        #[allow(unreachable_patterns)]
        self.resource_name.as_ref().and_then(|v| match v {
            crate::model::subscription::ResourceName::Listing(v) => std::option::Option::Some(v),
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [resource_name][crate::model::Subscription::resource_name]
    /// to hold a `Listing`.
    ///
    /// Note that all the setters affecting `resource_name` are
    /// mutually exclusive.
    pub fn set_listing<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.resource_name =
            std::option::Option::Some(crate::model::subscription::ResourceName::Listing(v.into()));
        self
    }

    /// The value of [resource_name][crate::model::Subscription::resource_name]
    /// if it holds a `DataExchange`, `None` if the field is not set or
    /// holds a different branch.
    pub fn data_exchange(&self) -> std::option::Option<&std::string::String> {
        #[allow(unreachable_patterns)]
        self.resource_name.as_ref().and_then(|v| match v {
            crate::model::subscription::ResourceName::DataExchange(v) => {
                std::option::Option::Some(v)
            }
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [resource_name][crate::model::Subscription::resource_name]
    /// to hold a `DataExchange`.
    ///
    /// Note that all the setters affecting `resource_name` are
    /// mutually exclusive.
    pub fn set_data_exchange<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.resource_name = std::option::Option::Some(
            crate::model::subscription::ResourceName::DataExchange(v.into()),
        );
        self
    }
}

impl wkt::message::Message for Subscription {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.bigquery.analyticshub.v1.Subscription"
    }
}

/// Defines additional types related to [Subscription].
pub mod subscription {
    #[allow(unused_imports)]
    use super::*;

    /// Reference to a linked resource tracked by this Subscription.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct LinkedResource {
        /// Output only. Listing for which linked resource is created.
        pub listing: std::string::String,

        pub reference: std::option::Option<crate::model::subscription::linked_resource::Reference>,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl LinkedResource {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [listing][crate::model::subscription::LinkedResource::listing].
        pub fn set_listing<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
            self.listing = v.into();
            self
        }

        /// Sets the value of [reference][crate::model::subscription::LinkedResource::reference].
        ///
        /// Note that all the setters affecting `reference` are mutually
        /// exclusive.
        pub fn set_reference<
            T: std::convert::Into<
                    std::option::Option<crate::model::subscription::linked_resource::Reference>,
                >,
        >(
            mut self,
            v: T,
        ) -> Self {
            self.reference = v.into();
            self
        }

        /// The value of [reference][crate::model::subscription::LinkedResource::reference]
        /// if it holds a `LinkedDataset`, `None` if the field is not set or
        /// holds a different branch.
        pub fn linked_dataset(&self) -> std::option::Option<&std::string::String> {
            #[allow(unreachable_patterns)]
            self.reference.as_ref().and_then(|v| match v {
                crate::model::subscription::linked_resource::Reference::LinkedDataset(v) => {
                    std::option::Option::Some(v)
                }
                _ => std::option::Option::None,
            })
        }

        /// Sets the value of [reference][crate::model::subscription::LinkedResource::reference]
        /// to hold a `LinkedDataset`.
        ///
        /// Note that all the setters affecting `reference` are
        /// mutually exclusive.
        pub fn set_linked_dataset<T: std::convert::Into<std::string::String>>(
            mut self,
            v: T,
        ) -> Self {
            self.reference = std::option::Option::Some(
                crate::model::subscription::linked_resource::Reference::LinkedDataset(v.into()),
            );
            self
        }

        /// The value of [reference][crate::model::subscription::LinkedResource::reference]
        /// if it holds a `LinkedPubsubSubscription`, `None` if the field is not set or
        /// holds a different branch.
        pub fn linked_pubsub_subscription(&self) -> std::option::Option<&std::string::String> {
            #[allow(unreachable_patterns)]
            self.reference.as_ref().and_then(|v| match v {
                crate::model::subscription::linked_resource::Reference::LinkedPubsubSubscription(v) => std::option::Option::Some(v),
                _ => std::option::Option::None,
            })
        }

        /// Sets the value of [reference][crate::model::subscription::LinkedResource::reference]
        /// to hold a `LinkedPubsubSubscription`.
        ///
        /// Note that all the setters affecting `reference` are
        /// mutually exclusive.
        pub fn set_linked_pubsub_subscription<T: std::convert::Into<std::string::String>>(
            mut self,
            v: T,
        ) -> Self {
            self.reference = std::option::Option::Some(
                crate::model::subscription::linked_resource::Reference::LinkedPubsubSubscription(
                    v.into(),
                ),
            );
            self
        }
    }

    impl wkt::message::Message for LinkedResource {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.bigquery.analyticshub.v1.Subscription.LinkedResource"
        }
    }

    /// Defines additional types related to [LinkedResource].
    pub mod linked_resource {
        #[allow(unused_imports)]
        use super::*;

        #[derive(Clone, Debug, PartialEq)]
        #[non_exhaustive]
        pub enum Reference {
            /// Output only. Name of the linked dataset, e.g.
            /// projects/subscriberproject/datasets/linked_dataset
            LinkedDataset(std::string::String),
            /// Output only. Name of the Pub/Sub subscription, e.g.
            /// projects/subscriberproject/subscriptions/subscriptions/sub_id
            LinkedPubsubSubscription(std::string::String),
        }
    }

    /// Commercial info metadata for this subscription.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct CommercialInfo {
        /// Output only. This is set when the subscription is commercialised via
        /// Cloud Marketplace.
        pub cloud_marketplace: std::option::Option<
            crate::model::subscription::commercial_info::GoogleCloudMarketplaceInfo,
        >,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl CommercialInfo {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [cloud_marketplace][crate::model::subscription::CommercialInfo::cloud_marketplace].
        pub fn set_cloud_marketplace<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<
                    crate::model::subscription::commercial_info::GoogleCloudMarketplaceInfo,
                >,
        {
            self.cloud_marketplace = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [cloud_marketplace][crate::model::subscription::CommercialInfo::cloud_marketplace].
        pub fn set_or_clear_cloud_marketplace<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<
                    crate::model::subscription::commercial_info::GoogleCloudMarketplaceInfo,
                >,
        {
            self.cloud_marketplace = v.map(|x| x.into());
            self
        }
    }

    impl wkt::message::Message for CommercialInfo {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.bigquery.analyticshub.v1.Subscription.CommercialInfo"
        }
    }

    /// Defines additional types related to [CommercialInfo].
    pub mod commercial_info {
        #[allow(unused_imports)]
        use super::*;

        /// Cloud Marketplace commercial metadata for this subscription.
        #[derive(Clone, Default, PartialEq)]
        #[non_exhaustive]
        pub struct GoogleCloudMarketplaceInfo {
            /// Resource name of the Marketplace Order.
            pub order: std::string::String,

            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
        }

        impl GoogleCloudMarketplaceInfo {
            pub fn new() -> Self {
                std::default::Default::default()
            }

            /// Sets the value of [order][crate::model::subscription::commercial_info::GoogleCloudMarketplaceInfo::order].
            pub fn set_order<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
                self.order = v.into();
                self
            }
        }

        impl wkt::message::Message for GoogleCloudMarketplaceInfo {
            fn typename() -> &'static str {
                "type.googleapis.com/google.cloud.bigquery.analyticshub.v1.Subscription.CommercialInfo.GoogleCloudMarketplaceInfo"
            }
        }
    }

    /// State of the subscription.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum State {
        /// Default value. This value is unused.
        Unspecified,
        /// This subscription is active and the data is accessible.
        Active,
        /// The data referenced by this subscription is out of date and should be
        /// refreshed. This can happen when a data provider adds or removes datasets.
        Stale,
        /// This subscription has been cancelled or revoked and the data is no longer
        /// accessible.
        Inactive,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [State::value] or
        /// [State::name].
        UnknownValue(state::UnknownValue),
    }

    #[doc(hidden)]
    pub mod state {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl State {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::Active => std::option::Option::Some(1),
                Self::Stale => std::option::Option::Some(2),
                Self::Inactive => std::option::Option::Some(3),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
                Self::Active => std::option::Option::Some("STATE_ACTIVE"),
                Self::Stale => std::option::Option::Some("STATE_STALE"),
                Self::Inactive => std::option::Option::Some("STATE_INACTIVE"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for State {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for State {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for State {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::Active,
                2 => Self::Stale,
                3 => Self::Inactive,
                _ => Self::UnknownValue(state::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for State {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "STATE_UNSPECIFIED" => Self::Unspecified,
                "STATE_ACTIVE" => Self::Active,
                "STATE_STALE" => Self::Stale,
                "STATE_INACTIVE" => Self::Inactive,
                _ => Self::UnknownValue(state::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for State {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::Active => serializer.serialize_i32(1),
                Self::Stale => serializer.serialize_i32(2),
                Self::Inactive => serializer.serialize_i32(3),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for State {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
                ".google.cloud.bigquery.analyticshub.v1.Subscription.State",
            ))
        }
    }

    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum ResourceName {
        /// Output only. Resource name of the source Listing.
        /// e.g. projects/123/locations/us/dataExchanges/456/listings/789
        Listing(std::string::String),
        /// Output only. Resource name of the source Data Exchange.
        /// e.g. projects/123/locations/us/dataExchanges/456
        DataExchange(std::string::String),
    }
}

/// Message for requesting the list of data exchanges.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListDataExchangesRequest {
    /// Required. The parent resource path of the data exchanges.
    /// e.g. `projects/myproject/locations/us`.
    pub parent: std::string::String,

    /// The maximum number of results to return in a single response page. Leverage
    /// the page tokens to iterate through the entire collection.
    pub page_size: i32,

    /// Page token, returned by a previous call, to request the next page of
    /// results.
    pub page_token: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListDataExchangesRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListDataExchangesRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListDataExchangesRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListDataExchangesRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }
}

impl wkt::message::Message for ListDataExchangesRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.bigquery.analyticshub.v1.ListDataExchangesRequest"
    }
}

/// Message for response to the list of data exchanges.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListDataExchangesResponse {
    /// The list of data exchanges.
    pub data_exchanges: std::vec::Vec<crate::model::DataExchange>,

    /// A token to request the next page of results.
    pub next_page_token: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListDataExchangesResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [data_exchanges][crate::model::ListDataExchangesResponse::data_exchanges].
    pub fn set_data_exchanges<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::DataExchange>,
    {
        use std::iter::Iterator;
        self.data_exchanges = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListDataExchangesResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }
}

impl wkt::message::Message for ListDataExchangesResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.bigquery.analyticshub.v1.ListDataExchangesResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListDataExchangesResponse {
    type PageItem = crate::model::DataExchange;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.data_exchanges
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// Message for requesting the list of data exchanges from projects in an
/// organization and location.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListOrgDataExchangesRequest {
    /// Required. The organization resource path of the projects containing
    /// DataExchanges. e.g. `organizations/myorg/locations/us`.
    pub organization: std::string::String,

    /// The maximum number of results to return in a single response page. Leverage
    /// the page tokens to iterate through the entire collection.
    pub page_size: i32,

    /// Page token, returned by a previous call, to request the next page of
    /// results.
    pub page_token: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListOrgDataExchangesRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [organization][crate::model::ListOrgDataExchangesRequest::organization].
    pub fn set_organization<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.organization = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListOrgDataExchangesRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListOrgDataExchangesRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }
}

impl wkt::message::Message for ListOrgDataExchangesRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.bigquery.analyticshub.v1.ListOrgDataExchangesRequest"
    }
}

/// Message for response to listing data exchanges in an organization and
/// location.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListOrgDataExchangesResponse {
    /// The list of data exchanges.
    pub data_exchanges: std::vec::Vec<crate::model::DataExchange>,

    /// A token to request the next page of results.
    pub next_page_token: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListOrgDataExchangesResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [data_exchanges][crate::model::ListOrgDataExchangesResponse::data_exchanges].
    pub fn set_data_exchanges<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::DataExchange>,
    {
        use std::iter::Iterator;
        self.data_exchanges = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListOrgDataExchangesResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }
}

impl wkt::message::Message for ListOrgDataExchangesResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.bigquery.analyticshub.v1.ListOrgDataExchangesResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListOrgDataExchangesResponse {
    type PageItem = crate::model::DataExchange;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.data_exchanges
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// Message for getting a data exchange.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetDataExchangeRequest {
    /// Required. The resource name of the data exchange.
    /// e.g. `projects/myproject/locations/us/dataExchanges/123`.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetDataExchangeRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetDataExchangeRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetDataExchangeRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.bigquery.analyticshub.v1.GetDataExchangeRequest"
    }
}

/// Message for creating a data exchange.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateDataExchangeRequest {
    /// Required. The parent resource path of the data exchange.
    /// e.g. `projects/myproject/locations/us`.
    pub parent: std::string::String,

    /// Required. The ID of the data exchange.
    /// Must contain only Unicode letters, numbers (0-9), underscores (_).
    /// Max length: 100 bytes.
    pub data_exchange_id: std::string::String,

    /// Required. The data exchange to create.
    pub data_exchange: std::option::Option<crate::model::DataExchange>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CreateDataExchangeRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::CreateDataExchangeRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [data_exchange_id][crate::model::CreateDataExchangeRequest::data_exchange_id].
    pub fn set_data_exchange_id<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.data_exchange_id = v.into();
        self
    }

    /// Sets the value of [data_exchange][crate::model::CreateDataExchangeRequest::data_exchange].
    pub fn set_data_exchange<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::DataExchange>,
    {
        self.data_exchange = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [data_exchange][crate::model::CreateDataExchangeRequest::data_exchange].
    pub fn set_or_clear_data_exchange<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::DataExchange>,
    {
        self.data_exchange = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for CreateDataExchangeRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.bigquery.analyticshub.v1.CreateDataExchangeRequest"
    }
}

/// Message for updating a data exchange.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateDataExchangeRequest {
    /// Required. Field mask specifies the fields to update in the data exchange
    /// resource. The fields specified in the
    /// `updateMask` are relative to the resource and are not a full request.
    pub update_mask: std::option::Option<wkt::FieldMask>,

    /// Required. The data exchange to update.
    pub data_exchange: std::option::Option<crate::model::DataExchange>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl UpdateDataExchangeRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [update_mask][crate::model::UpdateDataExchangeRequest::update_mask].
    pub fn set_update_mask<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_mask][crate::model::UpdateDataExchangeRequest::update_mask].
    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = v.map(|x| x.into());
        self
    }

    /// Sets the value of [data_exchange][crate::model::UpdateDataExchangeRequest::data_exchange].
    pub fn set_data_exchange<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::DataExchange>,
    {
        self.data_exchange = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [data_exchange][crate::model::UpdateDataExchangeRequest::data_exchange].
    pub fn set_or_clear_data_exchange<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::DataExchange>,
    {
        self.data_exchange = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for UpdateDataExchangeRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.bigquery.analyticshub.v1.UpdateDataExchangeRequest"
    }
}

/// Message for deleting a data exchange.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteDataExchangeRequest {
    /// Required. The full name of the data exchange resource that you want to
    /// delete. For example, `projects/myproject/locations/us/dataExchanges/123`.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DeleteDataExchangeRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::DeleteDataExchangeRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for DeleteDataExchangeRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.bigquery.analyticshub.v1.DeleteDataExchangeRequest"
    }
}

/// Message for requesting the list of listings.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListListingsRequest {
    /// Required. The parent resource path of the listing.
    /// e.g. `projects/myproject/locations/us/dataExchanges/123`.
    pub parent: std::string::String,

    /// The maximum number of results to return in a single response page. Leverage
    /// the page tokens to iterate through the entire collection.
    pub page_size: i32,

    /// Page token, returned by a previous call, to request the next page of
    /// results.
    pub page_token: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListListingsRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListListingsRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListListingsRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListListingsRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }
}

impl wkt::message::Message for ListListingsRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.bigquery.analyticshub.v1.ListListingsRequest"
    }
}

/// Message for response to the list of Listings.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListListingsResponse {
    /// The list of Listing.
    pub listings: std::vec::Vec<crate::model::Listing>,

    /// A token to request the next page of results.
    pub next_page_token: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListListingsResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [listings][crate::model::ListListingsResponse::listings].
    pub fn set_listings<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::Listing>,
    {
        use std::iter::Iterator;
        self.listings = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListListingsResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }
}

impl wkt::message::Message for ListListingsResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.bigquery.analyticshub.v1.ListListingsResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListListingsResponse {
    type PageItem = crate::model::Listing;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.listings
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// Message for getting a listing.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetListingRequest {
    /// Required. The resource name of the listing.
    /// e.g. `projects/myproject/locations/us/dataExchanges/123/listings/456`.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetListingRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetListingRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetListingRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.bigquery.analyticshub.v1.GetListingRequest"
    }
}

/// Message for creating a listing.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateListingRequest {
    /// Required. The parent resource path of the listing.
    /// e.g. `projects/myproject/locations/us/dataExchanges/123`.
    pub parent: std::string::String,

    /// Required. The ID of the listing to create.
    /// Must contain only Unicode letters, numbers (0-9), underscores (_).
    /// Max length: 100 bytes.
    pub listing_id: std::string::String,

    /// Required. The listing to create.
    pub listing: std::option::Option<crate::model::Listing>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CreateListingRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::CreateListingRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [listing_id][crate::model::CreateListingRequest::listing_id].
    pub fn set_listing_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.listing_id = v.into();
        self
    }

    /// Sets the value of [listing][crate::model::CreateListingRequest::listing].
    pub fn set_listing<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::Listing>,
    {
        self.listing = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [listing][crate::model::CreateListingRequest::listing].
    pub fn set_or_clear_listing<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::Listing>,
    {
        self.listing = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for CreateListingRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.bigquery.analyticshub.v1.CreateListingRequest"
    }
}

/// Message for updating a Listing.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateListingRequest {
    /// Required. Field mask specifies the fields to update in the listing
    /// resource. The fields specified in the `updateMask` are relative to the
    /// resource and are not a full request.
    pub update_mask: std::option::Option<wkt::FieldMask>,

    /// Required. The listing to update.
    pub listing: std::option::Option<crate::model::Listing>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl UpdateListingRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [update_mask][crate::model::UpdateListingRequest::update_mask].
    pub fn set_update_mask<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_mask][crate::model::UpdateListingRequest::update_mask].
    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = v.map(|x| x.into());
        self
    }

    /// Sets the value of [listing][crate::model::UpdateListingRequest::listing].
    pub fn set_listing<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::Listing>,
    {
        self.listing = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [listing][crate::model::UpdateListingRequest::listing].
    pub fn set_or_clear_listing<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::Listing>,
    {
        self.listing = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for UpdateListingRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.bigquery.analyticshub.v1.UpdateListingRequest"
    }
}

/// Message for deleting a listing.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteListingRequest {
    /// Required. Resource name of the listing to delete.
    /// e.g. `projects/myproject/locations/us/dataExchanges/123/listings/456`.
    pub name: std::string::String,

    /// Optional. If the listing is commercial then this field must be set to true,
    /// otherwise a failure is thrown. This acts as a safety guard to avoid
    /// deleting commercial listings accidentally.
    pub delete_commercial: bool,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DeleteListingRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::DeleteListingRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [delete_commercial][crate::model::DeleteListingRequest::delete_commercial].
    pub fn set_delete_commercial<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.delete_commercial = v.into();
        self
    }
}

impl wkt::message::Message for DeleteListingRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.bigquery.analyticshub.v1.DeleteListingRequest"
    }
}

/// Message for subscribing to a listing.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SubscribeListingRequest {
    /// Required. Resource name of the listing that you want to subscribe to.
    /// e.g. `projects/myproject/locations/us/dataExchanges/123/listings/456`.
    pub name: std::string::String,

    /// Resulting destination of the listing that you subscribed to.
    pub destination: std::option::Option<crate::model::subscribe_listing_request::Destination>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl SubscribeListingRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::SubscribeListingRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [destination][crate::model::SubscribeListingRequest::destination].
    ///
    /// Note that all the setters affecting `destination` are mutually
    /// exclusive.
    pub fn set_destination<
        T: std::convert::Into<
                std::option::Option<crate::model::subscribe_listing_request::Destination>,
            >,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.destination = v.into();
        self
    }

    /// The value of [destination][crate::model::SubscribeListingRequest::destination]
    /// if it holds a `DestinationDataset`, `None` if the field is not set or
    /// holds a different branch.
    pub fn destination_dataset(
        &self,
    ) -> std::option::Option<&std::boxed::Box<crate::model::DestinationDataset>> {
        #[allow(unreachable_patterns)]
        self.destination.as_ref().and_then(|v| match v {
            crate::model::subscribe_listing_request::Destination::DestinationDataset(v) => {
                std::option::Option::Some(v)
            }
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [destination][crate::model::SubscribeListingRequest::destination]
    /// to hold a `DestinationDataset`.
    ///
    /// Note that all the setters affecting `destination` are
    /// mutually exclusive.
    pub fn set_destination_dataset<
        T: std::convert::Into<std::boxed::Box<crate::model::DestinationDataset>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.destination = std::option::Option::Some(
            crate::model::subscribe_listing_request::Destination::DestinationDataset(v.into()),
        );
        self
    }

    /// The value of [destination][crate::model::SubscribeListingRequest::destination]
    /// if it holds a `DestinationPubsubSubscription`, `None` if the field is not set or
    /// holds a different branch.
    pub fn destination_pubsub_subscription(
        &self,
    ) -> std::option::Option<&std::boxed::Box<crate::model::DestinationPubSubSubscription>> {
        #[allow(unreachable_patterns)]
        self.destination.as_ref().and_then(|v| match v {
            crate::model::subscribe_listing_request::Destination::DestinationPubsubSubscription(
                v,
            ) => std::option::Option::Some(v),
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [destination][crate::model::SubscribeListingRequest::destination]
    /// to hold a `DestinationPubsubSubscription`.
    ///
    /// Note that all the setters affecting `destination` are
    /// mutually exclusive.
    pub fn set_destination_pubsub_subscription<
        T: std::convert::Into<std::boxed::Box<crate::model::DestinationPubSubSubscription>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.destination = std::option::Option::Some(
            crate::model::subscribe_listing_request::Destination::DestinationPubsubSubscription(
                v.into(),
            ),
        );
        self
    }
}

impl wkt::message::Message for SubscribeListingRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.bigquery.analyticshub.v1.SubscribeListingRequest"
    }
}

/// Defines additional types related to [SubscribeListingRequest].
pub mod subscribe_listing_request {
    #[allow(unused_imports)]
    use super::*;

    /// Resulting destination of the listing that you subscribed to.
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum Destination {
        /// Input only. BigQuery destination dataset to create for the subscriber.
        DestinationDataset(std::boxed::Box<crate::model::DestinationDataset>),
        /// Input only. Destination Pub/Sub subscription to create for the
        /// subscriber.
        DestinationPubsubSubscription(std::boxed::Box<crate::model::DestinationPubSubSubscription>),
    }
}

/// Message for response when you subscribe to a listing.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SubscribeListingResponse {
    /// Subscription object created from this subscribe action.
    pub subscription: std::option::Option<crate::model::Subscription>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl SubscribeListingResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [subscription][crate::model::SubscribeListingResponse::subscription].
    pub fn set_subscription<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::Subscription>,
    {
        self.subscription = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [subscription][crate::model::SubscribeListingResponse::subscription].
    pub fn set_or_clear_subscription<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::Subscription>,
    {
        self.subscription = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for SubscribeListingResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.bigquery.analyticshub.v1.SubscribeListingResponse"
    }
}

/// Message for subscribing to a Data Exchange.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SubscribeDataExchangeRequest {
    /// Required. Resource name of the Data Exchange.
    /// e.g. `projects/publisherproject/locations/us/dataExchanges/123`
    pub name: std::string::String,

    /// Required. The parent resource path of the Subscription.
    /// e.g. `projects/subscriberproject/locations/us`
    pub destination: std::string::String,

    /// Optional. BigQuery destination dataset to create for the subscriber.
    pub destination_dataset: std::option::Option<crate::model::DestinationDataset>,

    /// Required. Name of the subscription to create.
    /// e.g. `subscription1`
    pub subscription: std::string::String,

    /// Email of the subscriber.
    pub subscriber_contact: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl SubscribeDataExchangeRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::SubscribeDataExchangeRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [destination][crate::model::SubscribeDataExchangeRequest::destination].
    pub fn set_destination<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.destination = v.into();
        self
    }

    /// Sets the value of [destination_dataset][crate::model::SubscribeDataExchangeRequest::destination_dataset].
    pub fn set_destination_dataset<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::DestinationDataset>,
    {
        self.destination_dataset = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [destination_dataset][crate::model::SubscribeDataExchangeRequest::destination_dataset].
    pub fn set_or_clear_destination_dataset<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::DestinationDataset>,
    {
        self.destination_dataset = v.map(|x| x.into());
        self
    }

    /// Sets the value of [subscription][crate::model::SubscribeDataExchangeRequest::subscription].
    pub fn set_subscription<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.subscription = v.into();
        self
    }

    /// Sets the value of [subscriber_contact][crate::model::SubscribeDataExchangeRequest::subscriber_contact].
    pub fn set_subscriber_contact<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.subscriber_contact = v.into();
        self
    }
}

impl wkt::message::Message for SubscribeDataExchangeRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.bigquery.analyticshub.v1.SubscribeDataExchangeRequest"
    }
}

/// Message for response when you subscribe to a Data Exchange.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SubscribeDataExchangeResponse {
    /// Subscription object created from this subscribe action.
    pub subscription: std::option::Option<crate::model::Subscription>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl SubscribeDataExchangeResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [subscription][crate::model::SubscribeDataExchangeResponse::subscription].
    pub fn set_subscription<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::Subscription>,
    {
        self.subscription = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [subscription][crate::model::SubscribeDataExchangeResponse::subscription].
    pub fn set_or_clear_subscription<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::Subscription>,
    {
        self.subscription = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for SubscribeDataExchangeResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.bigquery.analyticshub.v1.SubscribeDataExchangeResponse"
    }
}

/// Message for refreshing a subscription.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RefreshSubscriptionRequest {
    /// Required. Resource name of the Subscription to refresh.
    /// e.g. `projects/subscriberproject/locations/us/subscriptions/123`
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl RefreshSubscriptionRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::RefreshSubscriptionRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for RefreshSubscriptionRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.bigquery.analyticshub.v1.RefreshSubscriptionRequest"
    }
}

/// Message for response when you refresh a subscription.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RefreshSubscriptionResponse {
    /// The refreshed subscription resource.
    pub subscription: std::option::Option<crate::model::Subscription>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl RefreshSubscriptionResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [subscription][crate::model::RefreshSubscriptionResponse::subscription].
    pub fn set_subscription<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::Subscription>,
    {
        self.subscription = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [subscription][crate::model::RefreshSubscriptionResponse::subscription].
    pub fn set_or_clear_subscription<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::Subscription>,
    {
        self.subscription = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for RefreshSubscriptionResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.bigquery.analyticshub.v1.RefreshSubscriptionResponse"
    }
}

/// Message for getting a subscription.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetSubscriptionRequest {
    /// Required. Resource name of the subscription.
    /// e.g. projects/123/locations/us/subscriptions/456
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetSubscriptionRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetSubscriptionRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetSubscriptionRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.bigquery.analyticshub.v1.GetSubscriptionRequest"
    }
}

/// Message for listing subscriptions.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListSubscriptionsRequest {
    /// Required. The parent resource path of the subscription.
    /// e.g. projects/myproject/locations/us
    pub parent: std::string::String,

    /// An expression for filtering the results of the request. Eligible
    /// fields for filtering are:
    ///
    /// + `listing`
    /// + `data_exchange`
    ///
    /// Alternatively, a literal wrapped in double quotes may be provided.
    /// This will be checked for an exact match against both fields above.
    ///
    /// In all cases, the full Data Exchange or Listing resource name must
    /// be provided. Some example of using filters:
    ///
    /// + data_exchange="projects/myproject/locations/us/dataExchanges/123"
    /// + listing="projects/123/locations/us/dataExchanges/456/listings/789"
    /// + "projects/myproject/locations/us/dataExchanges/123"
    pub filter: std::string::String,

    /// The maximum number of results to return in a single response page.
    pub page_size: i32,

    /// Page token, returned by a previous call.
    pub page_token: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListSubscriptionsRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListSubscriptionsRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [filter][crate::model::ListSubscriptionsRequest::filter].
    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.filter = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListSubscriptionsRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListSubscriptionsRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }
}

impl wkt::message::Message for ListSubscriptionsRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.bigquery.analyticshub.v1.ListSubscriptionsRequest"
    }
}

/// Message for response to the listing of subscriptions.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListSubscriptionsResponse {
    /// The list of subscriptions.
    pub subscriptions: std::vec::Vec<crate::model::Subscription>,

    /// Next page token.
    pub next_page_token: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListSubscriptionsResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [subscriptions][crate::model::ListSubscriptionsResponse::subscriptions].
    pub fn set_subscriptions<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::Subscription>,
    {
        use std::iter::Iterator;
        self.subscriptions = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListSubscriptionsResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }
}

impl wkt::message::Message for ListSubscriptionsResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.bigquery.analyticshub.v1.ListSubscriptionsResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListSubscriptionsResponse {
    type PageItem = crate::model::Subscription;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.subscriptions
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// Message for listing subscriptions of a shared resource.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListSharedResourceSubscriptionsRequest {
    /// Required. Resource name of the requested target. This resource may be
    /// either a Listing or a DataExchange. e.g.
    /// projects/123/locations/us/dataExchanges/456 OR e.g.
    /// projects/123/locations/us/dataExchanges/456/listings/789
    pub resource: std::string::String,

    /// If selected, includes deleted subscriptions in the response
    /// (up to 63 days after deletion).
    pub include_deleted_subscriptions: bool,

    /// The maximum number of results to return in a single response page.
    pub page_size: i32,

    /// Page token, returned by a previous call.
    pub page_token: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListSharedResourceSubscriptionsRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [resource][crate::model::ListSharedResourceSubscriptionsRequest::resource].
    pub fn set_resource<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.resource = v.into();
        self
    }

    /// Sets the value of [include_deleted_subscriptions][crate::model::ListSharedResourceSubscriptionsRequest::include_deleted_subscriptions].
    pub fn set_include_deleted_subscriptions<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.include_deleted_subscriptions = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListSharedResourceSubscriptionsRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListSharedResourceSubscriptionsRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }
}

impl wkt::message::Message for ListSharedResourceSubscriptionsRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.bigquery.analyticshub.v1.ListSharedResourceSubscriptionsRequest"
    }
}

/// Message for response to the listing of shared resource subscriptions.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListSharedResourceSubscriptionsResponse {
    /// The list of subscriptions.
    pub shared_resource_subscriptions: std::vec::Vec<crate::model::Subscription>,

    /// Next page token.
    pub next_page_token: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListSharedResourceSubscriptionsResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [shared_resource_subscriptions][crate::model::ListSharedResourceSubscriptionsResponse::shared_resource_subscriptions].
    pub fn set_shared_resource_subscriptions<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::Subscription>,
    {
        use std::iter::Iterator;
        self.shared_resource_subscriptions = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListSharedResourceSubscriptionsResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }
}

impl wkt::message::Message for ListSharedResourceSubscriptionsResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.bigquery.analyticshub.v1.ListSharedResourceSubscriptionsResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListSharedResourceSubscriptionsResponse {
    type PageItem = crate::model::Subscription;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.shared_resource_subscriptions
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// Message for revoking a subscription.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RevokeSubscriptionRequest {
    /// Required. Resource name of the subscription to revoke.
    /// e.g. projects/123/locations/us/subscriptions/456
    pub name: std::string::String,

    /// Optional. If the subscription is commercial then this field must be set to
    /// true, otherwise a failure is thrown. This acts as a safety guard to avoid
    /// revoking commercial subscriptions accidentally.
    pub revoke_commercial: bool,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl RevokeSubscriptionRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::RevokeSubscriptionRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [revoke_commercial][crate::model::RevokeSubscriptionRequest::revoke_commercial].
    pub fn set_revoke_commercial<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.revoke_commercial = v.into();
        self
    }
}

impl wkt::message::Message for RevokeSubscriptionRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.bigquery.analyticshub.v1.RevokeSubscriptionRequest"
    }
}

/// Message for response when you revoke a subscription.
/// Empty for now.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RevokeSubscriptionResponse {
    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl RevokeSubscriptionResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }
}

impl wkt::message::Message for RevokeSubscriptionResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.bigquery.analyticshub.v1.RevokeSubscriptionResponse"
    }
}

/// Message for deleting a subscription.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteSubscriptionRequest {
    /// Required. Resource name of the subscription to delete.
    /// e.g. projects/123/locations/us/subscriptions/456
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DeleteSubscriptionRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::DeleteSubscriptionRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for DeleteSubscriptionRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.bigquery.analyticshub.v1.DeleteSubscriptionRequest"
    }
}

/// Represents the metadata of a long-running operation in Analytics Hub.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct OperationMetadata {
    /// Output only. The time the operation was created.
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// Output only. The time the operation finished running.
    pub end_time: std::option::Option<wkt::Timestamp>,

    /// Output only. Server-defined resource path for the target of the operation.
    pub target: std::string::String,

    /// Output only. Name of the verb executed by the operation.
    pub verb: std::string::String,

    /// Output only. Human-readable status of the operation, if any.
    pub status_message: std::string::String,

    /// Output only. Identifies whether the user has requested cancellation
    /// of the operation. Operations that have successfully been cancelled
    /// have [Operation.error][] value with a
    /// [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to
    /// `Code.CANCELLED`.
    ///
    /// [google.rpc.Status.code]: rpc::model::Status::code
    pub requested_cancellation: bool,

    /// Output only. API version used to start the operation.
    pub api_version: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl OperationMetadata {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [create_time][crate::model::OperationMetadata::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::OperationMetadata::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [end_time][crate::model::OperationMetadata::end_time].
    pub fn set_end_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.end_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [end_time][crate::model::OperationMetadata::end_time].
    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.end_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [target][crate::model::OperationMetadata::target].
    pub fn set_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.target = v.into();
        self
    }

    /// Sets the value of [verb][crate::model::OperationMetadata::verb].
    pub fn set_verb<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.verb = v.into();
        self
    }

    /// Sets the value of [status_message][crate::model::OperationMetadata::status_message].
    pub fn set_status_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.status_message = v.into();
        self
    }

    /// Sets the value of [requested_cancellation][crate::model::OperationMetadata::requested_cancellation].
    pub fn set_requested_cancellation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.requested_cancellation = v.into();
        self
    }

    /// Sets the value of [api_version][crate::model::OperationMetadata::api_version].
    pub fn set_api_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.api_version = v.into();
        self
    }
}

impl wkt::message::Message for OperationMetadata {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.bigquery.analyticshub.v1.OperationMetadata"
    }
}

/// Defines the destination Pub/Sub subscription.
/// If none of `push_config`, `bigquery_config`, `cloud_storage_config`,
/// `pubsub_export_config`, or `pubsublite_export_config`
/// is set, then the subscriber will pull and ack messages using API methods. At
/// most one of these fields may be set.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct PubSubSubscription {
    /// Required. Name of the subscription.
    /// Format is `projects/{project}/subscriptions/{sub}`.
    pub name: std::string::String,

    /// Optional. If push delivery is used with this subscription, this field is
    /// used to configure it.
    pub push_config: std::option::Option<crate::model::PushConfig>,

    /// Optional. If delivery to BigQuery is used with this subscription, this
    /// field is used to configure it.
    pub bigquery_config: std::option::Option<crate::model::BigQueryConfig>,

    /// Optional. If delivery to Google Cloud Storage is used with this
    /// subscription, this field is used to configure it.
    pub cloud_storage_config: std::option::Option<crate::model::CloudStorageConfig>,

    /// Optional. The approximate amount of time (on a best-effort basis) Pub/Sub
    /// waits for the subscriber to acknowledge receipt before resending the
    /// message. In the interval after the message is delivered and before it is
    /// acknowledged, it is considered to be _outstanding_. During that time
    /// period, the message will not be redelivered (on a best-effort basis).
    ///
    /// For pull subscriptions, this value is used as the initial value for the ack
    /// deadline. To override this value for a given message, call
    /// `ModifyAckDeadline` with the corresponding `ack_id` if using
    /// non-streaming pull or send the `ack_id` in a
    /// `StreamingModifyAckDeadlineRequest` if using streaming pull.
    /// The minimum custom deadline you can specify is 10 seconds.
    /// The maximum custom deadline you can specify is 600 seconds (10 minutes).
    /// If this parameter is 0, a default value of 10 seconds is used.
    ///
    /// For push delivery, this value is also used to set the request timeout for
    /// the call to the push endpoint.
    ///
    /// If the subscriber never acknowledges the message, the Pub/Sub
    /// system will eventually redeliver the message.
    pub ack_deadline_seconds: i32,

    /// Optional. Indicates whether to retain acknowledged messages. If true, then
    /// messages are not expunged from the subscription's backlog, even if they are
    /// acknowledged, until they fall out of the `message_retention_duration`
    /// window. This must be true if you would like to [`Seek` to a timestamp]
    /// (<https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time>) in
    /// the past to replay previously-acknowledged messages.
    pub retain_acked_messages: bool,

    /// Optional. How long to retain unacknowledged messages in the subscription's
    /// backlog, from the moment a message is published. If `retain_acked_messages`
    /// is true, then this also configures the retention of acknowledged messages,
    /// and thus configures how far back in time a `Seek` can be done. Defaults to
    /// 7 days. Cannot be more than 31 days or less than 10 minutes.
    pub message_retention_duration: std::option::Option<wkt::Duration>,

    /// Optional. See [Creating and managing
    /// labels](https://cloud.google.com/pubsub/docs/labels).
    pub labels: std::collections::HashMap<std::string::String, std::string::String>,

    /// Optional. If true, messages published with the same `ordering_key` in
    /// `PubsubMessage` will be delivered to the subscribers in the order in which
    /// they are received by the Pub/Sub system. Otherwise, they may be delivered
    /// in any order.
    pub enable_message_ordering: bool,

    /// Optional. A policy that specifies the conditions for this subscription's
    /// expiration. A subscription is considered active as long as any connected
    /// subscriber is successfully consuming messages from the subscription or is
    /// issuing operations on the subscription. If `expiration_policy` is not set,
    /// a *default policy* with `ttl` of 31 days will be used. The minimum allowed
    /// value for `expiration_policy.ttl` is 1 day. If `expiration_policy` is set,
    /// but `expiration_policy.ttl` is not set, the subscription never expires.
    pub expiration_policy: std::option::Option<crate::model::ExpirationPolicy>,

    /// Optional. An expression written in the Pub/Sub [filter
    /// language](https://cloud.google.com/pubsub/docs/filtering). If non-empty,
    /// then only `PubsubMessage`s whose `attributes` field matches the filter are
    /// delivered on this subscription. If empty, then no messages are filtered
    /// out.
    pub filter: std::string::String,

    /// Optional. A policy that specifies the conditions for dead lettering
    /// messages in this subscription. If dead_letter_policy is not set, dead
    /// lettering is disabled.
    ///
    /// The Pub/Sub service account associated with this subscriptions's
    /// parent project (i.e.,
    /// service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have
    /// permission to Acknowledge() messages on this subscription.
    pub dead_letter_policy: std::option::Option<crate::model::DeadLetterPolicy>,

    /// Optional. A policy that specifies how Pub/Sub retries message delivery for
    /// this subscription.
    ///
    /// If not set, the default retry policy is applied. This generally implies
    /// that messages will be retried as soon as possible for healthy subscribers.
    /// RetryPolicy will be triggered on NACKs or acknowledgement deadline
    /// exceeded events for a given message.
    pub retry_policy: std::option::Option<crate::model::RetryPolicy>,

    /// Optional. Indicates whether the subscription is detached from its topic.
    /// Detached subscriptions don't receive messages from their topic and don't
    /// retain any backlog. `Pull` and `StreamingPull` requests will return
    /// FAILED_PRECONDITION. If the subscription is a push subscription, pushes to
    /// the endpoint will not be made.
    pub detached: bool,

    /// Optional. If true, Pub/Sub provides the following guarantees for the
    /// delivery of a message with a given value of `message_id` on this
    /// subscription:
    ///
    /// * The message sent to a subscriber is guaranteed not to be resent
    ///   before the message's acknowledgement deadline expires.
    /// * An acknowledged message will not be resent to a subscriber.
    ///
    /// Note that subscribers may still receive multiple copies of a message
    /// when `enable_exactly_once_delivery` is true if the message was published
    /// multiple times by a publisher client. These copies are  considered distinct
    /// by Pub/Sub and have distinct `message_id` values.
    pub enable_exactly_once_delivery: bool,

    /// Optional. Transforms to be applied to messages before they are delivered to
    /// subscribers. Transforms are applied in the order specified.
    pub message_transforms: std::vec::Vec<crate::model::MessageTransform>,

    /// Optional. Input only. Immutable. Tag keys/values directly bound to this
    /// resource. For example:
    /// "123/environment": "production",
    /// "123/costCenter": "marketing"
    pub tags: std::collections::HashMap<std::string::String, std::string::String>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl PubSubSubscription {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::PubSubSubscription::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [push_config][crate::model::PubSubSubscription::push_config].
    pub fn set_push_config<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::PushConfig>,
    {
        self.push_config = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [push_config][crate::model::PubSubSubscription::push_config].
    pub fn set_or_clear_push_config<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::PushConfig>,
    {
        self.push_config = v.map(|x| x.into());
        self
    }

    /// Sets the value of [bigquery_config][crate::model::PubSubSubscription::bigquery_config].
    pub fn set_bigquery_config<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::BigQueryConfig>,
    {
        self.bigquery_config = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [bigquery_config][crate::model::PubSubSubscription::bigquery_config].
    pub fn set_or_clear_bigquery_config<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::BigQueryConfig>,
    {
        self.bigquery_config = v.map(|x| x.into());
        self
    }

    /// Sets the value of [cloud_storage_config][crate::model::PubSubSubscription::cloud_storage_config].
    pub fn set_cloud_storage_config<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::CloudStorageConfig>,
    {
        self.cloud_storage_config = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [cloud_storage_config][crate::model::PubSubSubscription::cloud_storage_config].
    pub fn set_or_clear_cloud_storage_config<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::CloudStorageConfig>,
    {
        self.cloud_storage_config = v.map(|x| x.into());
        self
    }

    /// Sets the value of [ack_deadline_seconds][crate::model::PubSubSubscription::ack_deadline_seconds].
    pub fn set_ack_deadline_seconds<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.ack_deadline_seconds = v.into();
        self
    }

    /// Sets the value of [retain_acked_messages][crate::model::PubSubSubscription::retain_acked_messages].
    pub fn set_retain_acked_messages<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.retain_acked_messages = v.into();
        self
    }

    /// Sets the value of [message_retention_duration][crate::model::PubSubSubscription::message_retention_duration].
    pub fn set_message_retention_duration<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Duration>,
    {
        self.message_retention_duration = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [message_retention_duration][crate::model::PubSubSubscription::message_retention_duration].
    pub fn set_or_clear_message_retention_duration<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Duration>,
    {
        self.message_retention_duration = v.map(|x| x.into());
        self
    }

    /// Sets the value of [labels][crate::model::PubSubSubscription::labels].
    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }

    /// Sets the value of [enable_message_ordering][crate::model::PubSubSubscription::enable_message_ordering].
    pub fn set_enable_message_ordering<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.enable_message_ordering = v.into();
        self
    }

    /// Sets the value of [expiration_policy][crate::model::PubSubSubscription::expiration_policy].
    pub fn set_expiration_policy<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::ExpirationPolicy>,
    {
        self.expiration_policy = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [expiration_policy][crate::model::PubSubSubscription::expiration_policy].
    pub fn set_or_clear_expiration_policy<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::ExpirationPolicy>,
    {
        self.expiration_policy = v.map(|x| x.into());
        self
    }

    /// Sets the value of [filter][crate::model::PubSubSubscription::filter].
    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.filter = v.into();
        self
    }

    /// Sets the value of [dead_letter_policy][crate::model::PubSubSubscription::dead_letter_policy].
    pub fn set_dead_letter_policy<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::DeadLetterPolicy>,
    {
        self.dead_letter_policy = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [dead_letter_policy][crate::model::PubSubSubscription::dead_letter_policy].
    pub fn set_or_clear_dead_letter_policy<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::DeadLetterPolicy>,
    {
        self.dead_letter_policy = v.map(|x| x.into());
        self
    }

    /// Sets the value of [retry_policy][crate::model::PubSubSubscription::retry_policy].
    pub fn set_retry_policy<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::RetryPolicy>,
    {
        self.retry_policy = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [retry_policy][crate::model::PubSubSubscription::retry_policy].
    pub fn set_or_clear_retry_policy<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::RetryPolicy>,
    {
        self.retry_policy = v.map(|x| x.into());
        self
    }

    /// Sets the value of [detached][crate::model::PubSubSubscription::detached].
    pub fn set_detached<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.detached = v.into();
        self
    }

    /// Sets the value of [enable_exactly_once_delivery][crate::model::PubSubSubscription::enable_exactly_once_delivery].
    pub fn set_enable_exactly_once_delivery<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.enable_exactly_once_delivery = v.into();
        self
    }

    /// Sets the value of [message_transforms][crate::model::PubSubSubscription::message_transforms].
    pub fn set_message_transforms<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::MessageTransform>,
    {
        use std::iter::Iterator;
        self.message_transforms = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [tags][crate::model::PubSubSubscription::tags].
    pub fn set_tags<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.tags = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }
}

impl wkt::message::Message for PubSubSubscription {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.bigquery.analyticshub.v1.PubSubSubscription"
    }
}

/// A policy that specifies how Pub/Sub retries message delivery.
///
/// Retry delay will be exponential based on provided minimum and maximum
/// backoffs. <https://en.wikipedia.org/wiki/Exponential_backoff>.
///
/// RetryPolicy will be triggered on NACKs or acknowledgement deadline exceeded
/// events for a given message.
///
/// Retry Policy is implemented on a best effort basis. At times, the delay
/// between consecutive deliveries may not match the configuration. That is,
/// delay can be more or less than configured backoff.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RetryPolicy {
    /// Optional. The minimum delay between consecutive deliveries of a given
    /// message. Value should be between 0 and 600 seconds. Defaults to 10 seconds.
    pub minimum_backoff: std::option::Option<wkt::Duration>,

    /// Optional. The maximum delay between consecutive deliveries of a given
    /// message. Value should be between 0 and 600 seconds. Defaults to 600
    /// seconds.
    pub maximum_backoff: std::option::Option<wkt::Duration>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl RetryPolicy {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [minimum_backoff][crate::model::RetryPolicy::minimum_backoff].
    pub fn set_minimum_backoff<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Duration>,
    {
        self.minimum_backoff = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [minimum_backoff][crate::model::RetryPolicy::minimum_backoff].
    pub fn set_or_clear_minimum_backoff<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Duration>,
    {
        self.minimum_backoff = v.map(|x| x.into());
        self
    }

    /// Sets the value of [maximum_backoff][crate::model::RetryPolicy::maximum_backoff].
    pub fn set_maximum_backoff<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Duration>,
    {
        self.maximum_backoff = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [maximum_backoff][crate::model::RetryPolicy::maximum_backoff].
    pub fn set_or_clear_maximum_backoff<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Duration>,
    {
        self.maximum_backoff = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for RetryPolicy {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.bigquery.analyticshub.v1.RetryPolicy"
    }
}

/// Dead lettering is done on a best effort basis. The same message might be
/// dead lettered multiple times.
///
/// If validation on any of the fields fails at subscription creation/updation,
/// the create/update subscription request will fail.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeadLetterPolicy {
    /// Optional. The name of the topic to which dead letter messages should be
    /// published. Format is `projects/{project}/topics/{topic}`.The Pub/Sub
    /// service account associated with the enclosing subscription's parent project
    /// (i.e., service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must
    /// have permission to Publish() to this topic.
    ///
    /// The operation will fail if the topic does not exist.
    /// Users should ensure that there is a subscription attached to this topic
    /// since messages published to a topic with no subscriptions are lost.
    pub dead_letter_topic: std::string::String,

    /// Optional. The maximum number of delivery attempts for any message. The
    /// value must be between 5 and 100.
    ///
    /// The number of delivery attempts is defined as 1 + (the sum of number of
    /// NACKs and number of times the acknowledgement deadline has been exceeded
    /// for the message).
    ///
    /// A NACK is any call to ModifyAckDeadline with a 0 deadline. Note that
    /// client libraries may automatically extend ack_deadlines.
    ///
    /// This field will be honored on a best effort basis.
    ///
    /// If this parameter is 0, a default value of 5 is used.
    pub max_delivery_attempts: i32,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DeadLetterPolicy {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [dead_letter_topic][crate::model::DeadLetterPolicy::dead_letter_topic].
    pub fn set_dead_letter_topic<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.dead_letter_topic = v.into();
        self
    }

    /// Sets the value of [max_delivery_attempts][crate::model::DeadLetterPolicy::max_delivery_attempts].
    pub fn set_max_delivery_attempts<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.max_delivery_attempts = v.into();
        self
    }
}

impl wkt::message::Message for DeadLetterPolicy {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.bigquery.analyticshub.v1.DeadLetterPolicy"
    }
}

/// A policy that specifies the conditions for resource expiration (i.e.,
/// automatic resource deletion).
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ExpirationPolicy {
    /// Optional. Specifies the "time-to-live" duration for an associated resource.
    /// The resource expires if it is not active for a period of `ttl`. The
    /// definition of "activity" depends on the type of the associated resource.
    /// The minimum and maximum allowed values for `ttl` depend on the type of the
    /// associated resource, as well. If `ttl` is not set, the associated resource
    /// never expires.
    pub ttl: std::option::Option<wkt::Duration>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ExpirationPolicy {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [ttl][crate::model::ExpirationPolicy::ttl].
    pub fn set_ttl<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Duration>,
    {
        self.ttl = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [ttl][crate::model::ExpirationPolicy::ttl].
    pub fn set_or_clear_ttl<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Duration>,
    {
        self.ttl = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for ExpirationPolicy {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.bigquery.analyticshub.v1.ExpirationPolicy"
    }
}

/// Configuration for a push delivery endpoint.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct PushConfig {
    /// Optional. A URL locating the endpoint to which messages should be pushed.
    /// For example, a Webhook endpoint might use `<https://example.com/push>`.
    pub push_endpoint: std::string::String,

    /// Optional. Endpoint configuration attributes that can be used to control
    /// different aspects of the message delivery.
    ///
    /// The only currently supported attribute is `x-goog-version`, which you can
    /// use to change the format of the pushed message. This attribute
    /// indicates the version of the data expected by the endpoint. This
    /// controls the shape of the pushed message (i.e., its fields and metadata).
    ///
    /// If not present during the `CreateSubscription` call, it will default to
    /// the version of the Pub/Sub API used to make such call. If not present in a
    /// `ModifyPushConfig` call, its value will not be changed. `GetSubscription`
    /// calls will always return a valid version, even if the subscription was
    /// created without this attribute.
    ///
    /// The only supported values for the `x-goog-version` attribute are:
    ///
    /// * `v1beta1`: uses the push format defined in the v1beta1 Pub/Sub API.
    /// * `v1` or `v1beta2`: uses the push format defined in the v1 Pub/Sub API.
    ///
    /// For example:
    /// `attributes { "x-goog-version": "v1" }`
    pub attributes: std::collections::HashMap<std::string::String, std::string::String>,

    /// An authentication method used by push endpoints to verify the source of
    /// push requests. This can be used with push endpoints that are private by
    /// default to allow requests only from the Pub/Sub system, for example.
    /// This field is optional and should be set only by users interested in
    /// authenticated push.
    pub authentication_method: std::option::Option<crate::model::push_config::AuthenticationMethod>,

    /// The format of the delivered message to the push endpoint is defined by
    /// the chosen wrapper. When unset, `PubsubWrapper` is used.
    pub wrapper: std::option::Option<crate::model::push_config::Wrapper>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl PushConfig {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [push_endpoint][crate::model::PushConfig::push_endpoint].
    pub fn set_push_endpoint<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.push_endpoint = v.into();
        self
    }

    /// Sets the value of [attributes][crate::model::PushConfig::attributes].
    pub fn set_attributes<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.attributes = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }

    /// Sets the value of [authentication_method][crate::model::PushConfig::authentication_method].
    ///
    /// Note that all the setters affecting `authentication_method` are mutually
    /// exclusive.
    pub fn set_authentication_method<
        T: std::convert::Into<std::option::Option<crate::model::push_config::AuthenticationMethod>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.authentication_method = v.into();
        self
    }

    /// The value of [authentication_method][crate::model::PushConfig::authentication_method]
    /// if it holds a `OidcToken`, `None` if the field is not set or
    /// holds a different branch.
    pub fn oidc_token(
        &self,
    ) -> std::option::Option<&std::boxed::Box<crate::model::push_config::OidcToken>> {
        #[allow(unreachable_patterns)]
        self.authentication_method.as_ref().and_then(|v| match v {
            crate::model::push_config::AuthenticationMethod::OidcToken(v) => {
                std::option::Option::Some(v)
            }
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [authentication_method][crate::model::PushConfig::authentication_method]
    /// to hold a `OidcToken`.
    ///
    /// Note that all the setters affecting `authentication_method` are
    /// mutually exclusive.
    pub fn set_oidc_token<
        T: std::convert::Into<std::boxed::Box<crate::model::push_config::OidcToken>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.authentication_method = std::option::Option::Some(
            crate::model::push_config::AuthenticationMethod::OidcToken(v.into()),
        );
        self
    }

    /// Sets the value of [wrapper][crate::model::PushConfig::wrapper].
    ///
    /// Note that all the setters affecting `wrapper` are mutually
    /// exclusive.
    pub fn set_wrapper<
        T: std::convert::Into<std::option::Option<crate::model::push_config::Wrapper>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.wrapper = v.into();
        self
    }

    /// The value of [wrapper][crate::model::PushConfig::wrapper]
    /// if it holds a `PubsubWrapper`, `None` if the field is not set or
    /// holds a different branch.
    pub fn pubsub_wrapper(
        &self,
    ) -> std::option::Option<&std::boxed::Box<crate::model::push_config::PubsubWrapper>> {
        #[allow(unreachable_patterns)]
        self.wrapper.as_ref().and_then(|v| match v {
            crate::model::push_config::Wrapper::PubsubWrapper(v) => std::option::Option::Some(v),
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [wrapper][crate::model::PushConfig::wrapper]
    /// to hold a `PubsubWrapper`.
    ///
    /// Note that all the setters affecting `wrapper` are
    /// mutually exclusive.
    pub fn set_pubsub_wrapper<
        T: std::convert::Into<std::boxed::Box<crate::model::push_config::PubsubWrapper>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.wrapper =
            std::option::Option::Some(crate::model::push_config::Wrapper::PubsubWrapper(v.into()));
        self
    }

    /// The value of [wrapper][crate::model::PushConfig::wrapper]
    /// if it holds a `NoWrapper`, `None` if the field is not set or
    /// holds a different branch.
    pub fn no_wrapper(
        &self,
    ) -> std::option::Option<&std::boxed::Box<crate::model::push_config::NoWrapper>> {
        #[allow(unreachable_patterns)]
        self.wrapper.as_ref().and_then(|v| match v {
            crate::model::push_config::Wrapper::NoWrapper(v) => std::option::Option::Some(v),
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [wrapper][crate::model::PushConfig::wrapper]
    /// to hold a `NoWrapper`.
    ///
    /// Note that all the setters affecting `wrapper` are
    /// mutually exclusive.
    pub fn set_no_wrapper<
        T: std::convert::Into<std::boxed::Box<crate::model::push_config::NoWrapper>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.wrapper =
            std::option::Option::Some(crate::model::push_config::Wrapper::NoWrapper(v.into()));
        self
    }
}

impl wkt::message::Message for PushConfig {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.bigquery.analyticshub.v1.PushConfig"
    }
}

/// Defines additional types related to [PushConfig].
pub mod push_config {
    #[allow(unused_imports)]
    use super::*;

    /// Contains information needed for generating an
    /// [OpenID Connect
    /// token](https://developers.google.com/identity/protocols/OpenIDConnect).
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct OidcToken {
        /// Optional. [Service account
        /// email](https://cloud.google.com/iam/docs/service-accounts)
        /// used for generating the OIDC token. For more information
        /// on setting up authentication, see
        /// [Push subscriptions](https://cloud.google.com/pubsub/docs/push).
        pub service_account_email: std::string::String,

        /// Optional. Audience to be used when generating OIDC token. The audience
        /// claim identifies the recipients that the JWT is intended for. The
        /// audience value is a single case-sensitive string. Having multiple values
        /// (array) for the audience field is not supported. More info about the OIDC
        /// JWT token audience here:
        /// <https://tools.ietf.org/html/rfc7519#section-4.1.3> Note: if not specified,
        /// the Push endpoint URL will be used.
        pub audience: std::string::String,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl OidcToken {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [service_account_email][crate::model::push_config::OidcToken::service_account_email].
        pub fn set_service_account_email<T: std::convert::Into<std::string::String>>(
            mut self,
            v: T,
        ) -> Self {
            self.service_account_email = v.into();
            self
        }

        /// Sets the value of [audience][crate::model::push_config::OidcToken::audience].
        pub fn set_audience<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
            self.audience = v.into();
            self
        }
    }

    impl wkt::message::Message for OidcToken {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.bigquery.analyticshub.v1.PushConfig.OidcToken"
        }
    }

    /// The payload to the push endpoint is in the form of the JSON representation
    /// of a PubsubMessage
    /// (<https://cloud.google.com/pubsub/docs/reference/rpc/google.pubsub.v1#pubsubmessage>).
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct PubsubWrapper {
        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl PubsubWrapper {
        pub fn new() -> Self {
            std::default::Default::default()
        }
    }

    impl wkt::message::Message for PubsubWrapper {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.bigquery.analyticshub.v1.PushConfig.PubsubWrapper"
        }
    }

    /// Sets the `data` field as the HTTP body for delivery.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct NoWrapper {
        /// Optional. When true, writes the Pub/Sub message metadata to
        /// `x-goog-pubsub-<KEY>:<VAL>` headers of the HTTP request. Writes the
        /// Pub/Sub message attributes to `<KEY>:<VAL>` headers of the HTTP request.
        pub write_metadata: bool,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl NoWrapper {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [write_metadata][crate::model::push_config::NoWrapper::write_metadata].
        pub fn set_write_metadata<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
            self.write_metadata = v.into();
            self
        }
    }

    impl wkt::message::Message for NoWrapper {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.bigquery.analyticshub.v1.PushConfig.NoWrapper"
        }
    }

    /// An authentication method used by push endpoints to verify the source of
    /// push requests. This can be used with push endpoints that are private by
    /// default to allow requests only from the Pub/Sub system, for example.
    /// This field is optional and should be set only by users interested in
    /// authenticated push.
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum AuthenticationMethod {
        /// Optional. If specified, Pub/Sub will generate and attach an OIDC JWT
        /// token as an `Authorization` header in the HTTP request for every pushed
        /// message.
        OidcToken(std::boxed::Box<crate::model::push_config::OidcToken>),
    }

    /// The format of the delivered message to the push endpoint is defined by
    /// the chosen wrapper. When unset, `PubsubWrapper` is used.
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum Wrapper {
        /// Optional. When set, the payload to the push endpoint is in the form of
        /// the JSON representation of a PubsubMessage
        /// (<https://cloud.google.com/pubsub/docs/reference/rpc/google.pubsub.v1#pubsubmessage>).
        PubsubWrapper(std::boxed::Box<crate::model::push_config::PubsubWrapper>),
        /// Optional. When set, the payload to the push endpoint is not wrapped.
        NoWrapper(std::boxed::Box<crate::model::push_config::NoWrapper>),
    }
}

/// Configuration for a BigQuery subscription.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct BigQueryConfig {
    /// Optional. The name of the table to which to write data, of the form
    /// {projectId}.{datasetId}.{tableId}
    pub table: std::string::String,

    /// Optional. When true, use the topic's schema as the columns to write to in
    /// BigQuery, if it exists. `use_topic_schema` and `use_table_schema` cannot be
    /// enabled at the same time.
    pub use_topic_schema: bool,

    /// Optional. When true, write the subscription name, message_id, publish_time,
    /// attributes, and ordering_key to additional columns in the table. The
    /// subscription name, message_id, and publish_time fields are put in their own
    /// columns while all other message properties (other than data) are written to
    /// a JSON object in the attributes column.
    pub write_metadata: bool,

    /// Optional. When true and use_topic_schema is true, any fields that are a
    /// part of the topic schema that are not part of the BigQuery table schema are
    /// dropped when writing to BigQuery. Otherwise, the schemas must be kept in
    /// sync and any messages with extra fields are not written and remain in the
    /// subscription's backlog.
    pub drop_unknown_fields: bool,

    /// Optional. When true, use the BigQuery table's schema as the columns to
    /// write to in BigQuery. `use_table_schema` and `use_topic_schema` cannot be
    /// enabled at the same time.
    pub use_table_schema: bool,

    /// Optional. The service account to use to write to BigQuery. The subscription
    /// creator or updater that specifies this field must have
    /// `iam.serviceAccounts.actAs` permission on the service account. If not
    /// specified, the Pub/Sub [service
    /// agent](https://cloud.google.com/iam/docs/service-agents),
    /// service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com, is used.
    pub service_account_email: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl BigQueryConfig {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [table][crate::model::BigQueryConfig::table].
    pub fn set_table<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.table = v.into();
        self
    }

    /// Sets the value of [use_topic_schema][crate::model::BigQueryConfig::use_topic_schema].
    pub fn set_use_topic_schema<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.use_topic_schema = v.into();
        self
    }

    /// Sets the value of [write_metadata][crate::model::BigQueryConfig::write_metadata].
    pub fn set_write_metadata<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.write_metadata = v.into();
        self
    }

    /// Sets the value of [drop_unknown_fields][crate::model::BigQueryConfig::drop_unknown_fields].
    pub fn set_drop_unknown_fields<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.drop_unknown_fields = v.into();
        self
    }

    /// Sets the value of [use_table_schema][crate::model::BigQueryConfig::use_table_schema].
    pub fn set_use_table_schema<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.use_table_schema = v.into();
        self
    }

    /// Sets the value of [service_account_email][crate::model::BigQueryConfig::service_account_email].
    pub fn set_service_account_email<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.service_account_email = v.into();
        self
    }
}

impl wkt::message::Message for BigQueryConfig {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.bigquery.analyticshub.v1.BigQueryConfig"
    }
}

/// Configuration for a Cloud Storage subscription.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CloudStorageConfig {
    /// Required. User-provided name for the Cloud Storage bucket.
    /// The bucket must be created by the user. The bucket name must be without
    /// any prefix like "gs://". See the [bucket naming
    /// requirements] (<https://cloud.google.com/storage/docs/buckets#naming>).
    pub bucket: std::string::String,

    /// Optional. User-provided prefix for Cloud Storage filename. See the [object
    /// naming requirements](https://cloud.google.com/storage/docs/objects#naming).
    pub filename_prefix: std::string::String,

    /// Optional. User-provided suffix for Cloud Storage filename. See the [object
    /// naming requirements](https://cloud.google.com/storage/docs/objects#naming).
    /// Must not end in "/".
    pub filename_suffix: std::string::String,

    /// Optional. User-provided format string specifying how to represent datetimes
    /// in Cloud Storage filenames. See the [datetime format
    /// guidance](https://cloud.google.com/pubsub/docs/create-cloudstorage-subscription#file_names).
    pub filename_datetime_format: std::string::String,

    /// Optional. File batching settings.
    /// If no max_duration setting is specified, a max_duration of 5 minutes will
    /// be set by default. max_duration is required regardless of whether other
    /// file batching settings are specified.
    ///
    /// The maximum duration that can elapse before a new Cloud Storage file is
    /// created. Min 1 minute, max 10 minutes, default 5 minutes. May not exceed
    /// the subscription's acknowledgement deadline.
    pub max_duration: std::option::Option<wkt::Duration>,

    /// Optional. The maximum bytes that can be written to a Cloud Storage file
    /// before a new file is created. Min 1 KB, max 10 GiB. The max_bytes limit may
    /// be exceeded in cases where messages are larger than the limit.
    pub max_bytes: i64,

    /// Optional. The maximum number of messages that can be written to a Cloud
    /// Storage file before a new file is created. Min 1000 messages.
    pub max_messages: i64,

    /// Optional. The service account to use to write to Cloud Storage. The
    /// subscription creator or updater that specifies this field must have
    /// `iam.serviceAccounts.actAs` permission on the service account. If not
    /// specified, the Pub/Sub
    /// [service agent](https://cloud.google.com/iam/docs/service-agents),
    /// service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com, is used.
    pub service_account_email: std::string::String,

    /// Defaults to text format.
    pub output_format: std::option::Option<crate::model::cloud_storage_config::OutputFormat>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CloudStorageConfig {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [bucket][crate::model::CloudStorageConfig::bucket].
    pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.bucket = v.into();
        self
    }

    /// Sets the value of [filename_prefix][crate::model::CloudStorageConfig::filename_prefix].
    pub fn set_filename_prefix<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.filename_prefix = v.into();
        self
    }

    /// Sets the value of [filename_suffix][crate::model::CloudStorageConfig::filename_suffix].
    pub fn set_filename_suffix<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.filename_suffix = v.into();
        self
    }

    /// Sets the value of [filename_datetime_format][crate::model::CloudStorageConfig::filename_datetime_format].
    pub fn set_filename_datetime_format<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.filename_datetime_format = v.into();
        self
    }

    /// Sets the value of [max_duration][crate::model::CloudStorageConfig::max_duration].
    pub fn set_max_duration<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Duration>,
    {
        self.max_duration = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [max_duration][crate::model::CloudStorageConfig::max_duration].
    pub fn set_or_clear_max_duration<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Duration>,
    {
        self.max_duration = v.map(|x| x.into());
        self
    }

    /// Sets the value of [max_bytes][crate::model::CloudStorageConfig::max_bytes].
    pub fn set_max_bytes<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
        self.max_bytes = v.into();
        self
    }

    /// Sets the value of [max_messages][crate::model::CloudStorageConfig::max_messages].
    pub fn set_max_messages<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
        self.max_messages = v.into();
        self
    }

    /// Sets the value of [service_account_email][crate::model::CloudStorageConfig::service_account_email].
    pub fn set_service_account_email<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.service_account_email = v.into();
        self
    }

    /// Sets the value of [output_format][crate::model::CloudStorageConfig::output_format].
    ///
    /// Note that all the setters affecting `output_format` are mutually
    /// exclusive.
    pub fn set_output_format<
        T: std::convert::Into<std::option::Option<crate::model::cloud_storage_config::OutputFormat>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.output_format = v.into();
        self
    }

    /// The value of [output_format][crate::model::CloudStorageConfig::output_format]
    /// if it holds a `TextConfig`, `None` if the field is not set or
    /// holds a different branch.
    pub fn text_config(
        &self,
    ) -> std::option::Option<&std::boxed::Box<crate::model::cloud_storage_config::TextConfig>> {
        #[allow(unreachable_patterns)]
        self.output_format.as_ref().and_then(|v| match v {
            crate::model::cloud_storage_config::OutputFormat::TextConfig(v) => {
                std::option::Option::Some(v)
            }
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [output_format][crate::model::CloudStorageConfig::output_format]
    /// to hold a `TextConfig`.
    ///
    /// Note that all the setters affecting `output_format` are
    /// mutually exclusive.
    pub fn set_text_config<
        T: std::convert::Into<std::boxed::Box<crate::model::cloud_storage_config::TextConfig>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.output_format = std::option::Option::Some(
            crate::model::cloud_storage_config::OutputFormat::TextConfig(v.into()),
        );
        self
    }

    /// The value of [output_format][crate::model::CloudStorageConfig::output_format]
    /// if it holds a `AvroConfig`, `None` if the field is not set or
    /// holds a different branch.
    pub fn avro_config(
        &self,
    ) -> std::option::Option<&std::boxed::Box<crate::model::cloud_storage_config::AvroConfig>> {
        #[allow(unreachable_patterns)]
        self.output_format.as_ref().and_then(|v| match v {
            crate::model::cloud_storage_config::OutputFormat::AvroConfig(v) => {
                std::option::Option::Some(v)
            }
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [output_format][crate::model::CloudStorageConfig::output_format]
    /// to hold a `AvroConfig`.
    ///
    /// Note that all the setters affecting `output_format` are
    /// mutually exclusive.
    pub fn set_avro_config<
        T: std::convert::Into<std::boxed::Box<crate::model::cloud_storage_config::AvroConfig>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.output_format = std::option::Option::Some(
            crate::model::cloud_storage_config::OutputFormat::AvroConfig(v.into()),
        );
        self
    }
}

impl wkt::message::Message for CloudStorageConfig {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.bigquery.analyticshub.v1.CloudStorageConfig"
    }
}

/// Defines additional types related to [CloudStorageConfig].
pub mod cloud_storage_config {
    #[allow(unused_imports)]
    use super::*;

    /// Configuration for writing message data in text format.
    /// Message payloads will be written to files as raw text, separated by a
    /// newline.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct TextConfig {
        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl TextConfig {
        pub fn new() -> Self {
            std::default::Default::default()
        }
    }

    impl wkt::message::Message for TextConfig {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.bigquery.analyticshub.v1.CloudStorageConfig.TextConfig"
        }
    }

    /// Configuration for writing message data in Avro format.
    /// Message payloads and metadata will be written to files as an Avro binary.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct AvroConfig {
        /// Optional. When true, write the subscription name, message_id,
        /// publish_time, attributes, and ordering_key as additional fields in the
        /// output. The subscription name, message_id, and publish_time fields are
        /// put in their own fields while all other message properties other than
        /// data (for example, an ordering_key, if present) are added as entries in
        /// the attributes map.
        pub write_metadata: bool,

        /// Optional. When true, the output Cloud Storage file will be serialized
        /// using the topic schema, if it exists.
        pub use_topic_schema: bool,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl AvroConfig {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [write_metadata][crate::model::cloud_storage_config::AvroConfig::write_metadata].
        pub fn set_write_metadata<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
            self.write_metadata = v.into();
            self
        }

        /// Sets the value of [use_topic_schema][crate::model::cloud_storage_config::AvroConfig::use_topic_schema].
        pub fn set_use_topic_schema<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
            self.use_topic_schema = v.into();
            self
        }
    }

    impl wkt::message::Message for AvroConfig {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.bigquery.analyticshub.v1.CloudStorageConfig.AvroConfig"
        }
    }

    /// Defaults to text format.
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum OutputFormat {
        /// Optional. If set, message data will be written to Cloud Storage in text
        /// format.
        TextConfig(std::boxed::Box<crate::model::cloud_storage_config::TextConfig>),
        /// Optional. If set, message data will be written to Cloud Storage in Avro
        /// format.
        AvroConfig(std::boxed::Box<crate::model::cloud_storage_config::AvroConfig>),
    }
}

/// All supported message transforms types.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct MessageTransform {
    /// Optional. This field is deprecated, use the `disabled` field to disable
    /// transforms.
    #[deprecated]
    pub enabled: bool,

    /// Optional. If true, the transform is disabled and will not be applied to
    /// messages. Defaults to `false`.
    pub disabled: bool,

    /// The type of transform to apply to messages.
    pub transform: std::option::Option<crate::model::message_transform::Transform>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl MessageTransform {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [enabled][crate::model::MessageTransform::enabled].
    #[deprecated]
    pub fn set_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.enabled = v.into();
        self
    }

    /// Sets the value of [disabled][crate::model::MessageTransform::disabled].
    pub fn set_disabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.disabled = v.into();
        self
    }

    /// Sets the value of [transform][crate::model::MessageTransform::transform].
    ///
    /// Note that all the setters affecting `transform` are mutually
    /// exclusive.
    pub fn set_transform<
        T: std::convert::Into<std::option::Option<crate::model::message_transform::Transform>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.transform = v.into();
        self
    }

    /// The value of [transform][crate::model::MessageTransform::transform]
    /// if it holds a `JavascriptUdf`, `None` if the field is not set or
    /// holds a different branch.
    pub fn javascript_udf(
        &self,
    ) -> std::option::Option<&std::boxed::Box<crate::model::JavaScriptUDF>> {
        #[allow(unreachable_patterns)]
        self.transform.as_ref().and_then(|v| match v {
            crate::model::message_transform::Transform::JavascriptUdf(v) => {
                std::option::Option::Some(v)
            }
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [transform][crate::model::MessageTransform::transform]
    /// to hold a `JavascriptUdf`.
    ///
    /// Note that all the setters affecting `transform` are
    /// mutually exclusive.
    pub fn set_javascript_udf<
        T: std::convert::Into<std::boxed::Box<crate::model::JavaScriptUDF>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.transform = std::option::Option::Some(
            crate::model::message_transform::Transform::JavascriptUdf(v.into()),
        );
        self
    }
}

impl wkt::message::Message for MessageTransform {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.bigquery.analyticshub.v1.MessageTransform"
    }
}

/// Defines additional types related to [MessageTransform].
pub mod message_transform {
    #[allow(unused_imports)]
    use super::*;

    /// The type of transform to apply to messages.
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum Transform {
        /// Optional. JavaScript User Defined Function. If multiple JavaScriptUDF's
        /// are specified on a resource, each must have a unique `function_name`.
        JavascriptUdf(std::boxed::Box<crate::model::JavaScriptUDF>),
    }
}

/// User-defined JavaScript function that can transform or filter a Pub/Sub
/// message.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct JavaScriptUDF {
    /// Required. Name of the JavasScript function that should applied to Pub/Sub
    /// messages.
    pub function_name: std::string::String,

    /// Required. JavaScript code that contains a function `function_name` with the
    /// below signature:
    ///
    /// ```norust
    ///   /**
    ///   * Transforms a Pub/Sub message.
    ///
    ///   * @return {(Object<string, (string | Object<string, string>)>|null)} - To
    ///   * filter a message, return `null`. To transform a message return a map
    ///   * with the following keys:
    ///   *   - (required) 'data' : {string}
    ///   *   - (optional) 'attributes' : {Object<string, string>}
    ///   * Returning empty `attributes` will remove all attributes from the
    ///   * message.
    ///   *
    ///   * @param  {(Object<string, (string | Object<string, string>)>} Pub/Sub
    ///   * message. Keys:
    ///   *   - (required) 'data' : {string}
    ///   *   - (required) 'attributes' : {Object<string, string>}
    ///   *
    ///   * @param  {Object<string, any>} metadata - Pub/Sub message metadata.
    ///   * Keys:
    ///   *   - (required) 'message_id'  : {string}
    ///   *   - (optional) 'publish_time': {string} YYYY-MM-DDTHH:MM:SSZ format
    ///   *   - (optional) 'ordering_key': {string}
    ///   */
    ///
    ///   function <function_name>(message, metadata) {
    ///   }
    /// ```
    pub code: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl JavaScriptUDF {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [function_name][crate::model::JavaScriptUDF::function_name].
    pub fn set_function_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.function_name = v.into();
        self
    }

    /// Sets the value of [code][crate::model::JavaScriptUDF::code].
    pub fn set_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.code = v.into();
        self
    }
}

impl wkt::message::Message for JavaScriptUDF {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.bigquery.analyticshub.v1.JavaScriptUDF"
    }
}

/// Specifies the type of discovery on the discovery page. Note that
/// this does not control the visibility of the exchange/listing which is
/// defined by IAM permission.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum DiscoveryType {
    /// Unspecified. Defaults to DISCOVERY_TYPE_PRIVATE.
    Unspecified,
    /// The Data exchange/listing can be discovered in the 'Private' results
    /// list.
    Private,
    /// The Data exchange/listing can be discovered in the 'Public' results
    /// list.
    Public,
    /// If set, the enum was initialized with an unknown value.
    ///
    /// Applications can examine the value using [DiscoveryType::value] or
    /// [DiscoveryType::name].
    UnknownValue(discovery_type::UnknownValue),
}

#[doc(hidden)]
pub mod discovery_type {
    #[allow(unused_imports)]
    use super::*;
    #[derive(Clone, Debug, PartialEq)]
    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}

impl DiscoveryType {
    /// Gets the enum value.
    ///
    /// Returns `None` if the enum contains an unknown value deserialized from
    /// the string representation of enums.
    pub fn value(&self) -> std::option::Option<i32> {
        match self {
            Self::Unspecified => std::option::Option::Some(0),
            Self::Private => std::option::Option::Some(1),
            Self::Public => std::option::Option::Some(2),
            Self::UnknownValue(u) => u.0.value(),
        }
    }

    /// Gets the enum value as a string.
    ///
    /// Returns `None` if the enum contains an unknown value deserialized from
    /// the integer representation of enums.
    pub fn name(&self) -> std::option::Option<&str> {
        match self {
            Self::Unspecified => std::option::Option::Some("DISCOVERY_TYPE_UNSPECIFIED"),
            Self::Private => std::option::Option::Some("DISCOVERY_TYPE_PRIVATE"),
            Self::Public => std::option::Option::Some("DISCOVERY_TYPE_PUBLIC"),
            Self::UnknownValue(u) => u.0.name(),
        }
    }
}

impl std::default::Default for DiscoveryType {
    fn default() -> Self {
        use std::convert::From;
        Self::from(0)
    }
}

impl std::fmt::Display for DiscoveryType {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
        wkt::internal::display_enum(f, self.name(), self.value())
    }
}

impl std::convert::From<i32> for DiscoveryType {
    fn from(value: i32) -> Self {
        match value {
            0 => Self::Unspecified,
            1 => Self::Private,
            2 => Self::Public,
            _ => Self::UnknownValue(discovery_type::UnknownValue(
                wkt::internal::UnknownEnumValue::Integer(value),
            )),
        }
    }
}

impl std::convert::From<&str> for DiscoveryType {
    fn from(value: &str) -> Self {
        use std::string::ToString;
        match value {
            "DISCOVERY_TYPE_UNSPECIFIED" => Self::Unspecified,
            "DISCOVERY_TYPE_PRIVATE" => Self::Private,
            "DISCOVERY_TYPE_PUBLIC" => Self::Public,
            _ => Self::UnknownValue(discovery_type::UnknownValue(
                wkt::internal::UnknownEnumValue::String(value.to_string()),
            )),
        }
    }
}

impl serde::ser::Serialize for DiscoveryType {
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        match self {
            Self::Unspecified => serializer.serialize_i32(0),
            Self::Private => serializer.serialize_i32(1),
            Self::Public => serializer.serialize_i32(2),
            Self::UnknownValue(u) => u.0.serialize(serializer),
        }
    }
}

impl<'de> serde::de::Deserialize<'de> for DiscoveryType {
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        deserializer.deserialize_any(wkt::internal::EnumVisitor::<DiscoveryType>::new(
            ".google.cloud.bigquery.analyticshub.v1.DiscoveryType",
        ))
    }
}

/// The underlying shared asset type shared in a listing by a publisher.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum SharedResourceType {
    /// Not specified.
    Unspecified,
    /// BigQuery Dataset Asset.
    BigqueryDataset,
    /// Pub/Sub Topic Asset.
    PubsubTopic,
    /// If set, the enum was initialized with an unknown value.
    ///
    /// Applications can examine the value using [SharedResourceType::value] or
    /// [SharedResourceType::name].
    UnknownValue(shared_resource_type::UnknownValue),
}

#[doc(hidden)]
pub mod shared_resource_type {
    #[allow(unused_imports)]
    use super::*;
    #[derive(Clone, Debug, PartialEq)]
    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}

impl SharedResourceType {
    /// Gets the enum value.
    ///
    /// Returns `None` if the enum contains an unknown value deserialized from
    /// the string representation of enums.
    pub fn value(&self) -> std::option::Option<i32> {
        match self {
            Self::Unspecified => std::option::Option::Some(0),
            Self::BigqueryDataset => std::option::Option::Some(1),
            Self::PubsubTopic => std::option::Option::Some(2),
            Self::UnknownValue(u) => u.0.value(),
        }
    }

    /// Gets the enum value as a string.
    ///
    /// Returns `None` if the enum contains an unknown value deserialized from
    /// the integer representation of enums.
    pub fn name(&self) -> std::option::Option<&str> {
        match self {
            Self::Unspecified => std::option::Option::Some("SHARED_RESOURCE_TYPE_UNSPECIFIED"),
            Self::BigqueryDataset => std::option::Option::Some("BIGQUERY_DATASET"),
            Self::PubsubTopic => std::option::Option::Some("PUBSUB_TOPIC"),
            Self::UnknownValue(u) => u.0.name(),
        }
    }
}

impl std::default::Default for SharedResourceType {
    fn default() -> Self {
        use std::convert::From;
        Self::from(0)
    }
}

impl std::fmt::Display for SharedResourceType {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
        wkt::internal::display_enum(f, self.name(), self.value())
    }
}

impl std::convert::From<i32> for SharedResourceType {
    fn from(value: i32) -> Self {
        match value {
            0 => Self::Unspecified,
            1 => Self::BigqueryDataset,
            2 => Self::PubsubTopic,
            _ => Self::UnknownValue(shared_resource_type::UnknownValue(
                wkt::internal::UnknownEnumValue::Integer(value),
            )),
        }
    }
}

impl std::convert::From<&str> for SharedResourceType {
    fn from(value: &str) -> Self {
        use std::string::ToString;
        match value {
            "SHARED_RESOURCE_TYPE_UNSPECIFIED" => Self::Unspecified,
            "BIGQUERY_DATASET" => Self::BigqueryDataset,
            "PUBSUB_TOPIC" => Self::PubsubTopic,
            _ => Self::UnknownValue(shared_resource_type::UnknownValue(
                wkt::internal::UnknownEnumValue::String(value.to_string()),
            )),
        }
    }
}

impl serde::ser::Serialize for SharedResourceType {
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        match self {
            Self::Unspecified => serializer.serialize_i32(0),
            Self::BigqueryDataset => serializer.serialize_i32(1),
            Self::PubsubTopic => serializer.serialize_i32(2),
            Self::UnknownValue(u) => u.0.serialize(serializer),
        }
    }
}

impl<'de> serde::de::Deserialize<'de> for SharedResourceType {
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        deserializer.deserialize_any(wkt::internal::EnumVisitor::<SharedResourceType>::new(
            ".google.cloud.bigquery.analyticshub.v1.SharedResourceType",
        ))
    }
}
